Java program startup parameter-D is used for what?

Source: Internet
Author: User

Java program startup parameter-D is used to do what? To inquire about the official explanation:

Set a System property value. If Value is a string of contains spaces, you must enclose the string in double quotes:

java-dfoo= "some string" SomeClass

That is,-D is used to set system property values when starting a Java program. If the value is a string and contains spaces, it needs to be wrapped in a pair of double quotation marks.

What is the System attribute value? That is, a string of system properties that are obtained through GetProperties () in the System class.

Let's write a test method to find out!

public class Testsystem {public static void main (String args[]) {System.out.println (System.getproperty ("FUCK.ABC"));}}

Add the JVM parameter-dfuck.abc= "1234" When running the program, then you can see the console output 1234 after running!

It is worth noting that the JVM parameters need to be set instead of the program parameters, note


What does the program arguments refer to here? This refers to the args array in the Main method ~



Java program startup parameter-D is used for what?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.