-D <name> = <value>: set a system property set up the system property.
The official explanation:
Set a system property value. If value is a string that contains spaces, you must enclose the string in double quotes:
1.j AVA -D plurality of parameters simplified jar was added
-Cp parameters can be introduced into the jar java command, but -cp not use wildcards (multiple jar What a bother to write, can not * .jar), the surface of the jar are usually in the same directory, and more than one. ) -Djava.ext.dirs jar can solve multiple problems
Such as:
java -Djava.ext.dirs=lib MyClass
2. You can configure some properties before running, such as other properties
java -Dconf1="wqbin" Myclass
By System.getProperty ( "conf1"); this value is obtained
It can also be seen from the idea:
3. Supplement Standard System Properties
Key | Meaning |
---|---|
"file.separator" |
Character that separates components of a file path. This is "/ " on UNIX and "\ " on Windows. |
"java.class.path" |
Path used to find directories and JAR archives containing class files. Elements of the class path are separated by a platform-specific character specified in the path.separator property. |
"java.home" |
Installation directory for Java Runtime Environment (JRE) |
"java.vendor" |
JRE vendor name |
"java.vendor.url" |
JRE sell URL |
"java.version" |
JRE version number |
"line.separator" |
Sequence used by operating system to separate lines in text files |
"os.arch" |
Operating system architecture |
"os.name" |
Operating system name |
"os.version" |
Operating system version |
"path.separator" |
Path separator character used in java.class.path |
"user.dir" |
User working directory |
"user.home" |
User home directory |
"user.name" |
User account name |