Recently when looking at the code to see the System.getproperty ("User.dir") This method, think it is necessary to remember, will all with System.getproperty (), the relevant parameters here for a moment, here are some explanations of these parameters:
One: System.getproperty () parameters that can be passed
(1) Java.vendor Java Runtime Environment provider
(2) URL of java.vendor.url Java vendor
(3) Java.home Java installation directory
(4) Java.vm.specification.version Java Virtual Machine specification version
(5) Java.vm.specification.vendor Java Virtual machine specification provider
(6) Java.vm.specification.name Java Virtual Machine specification name
(7) Java.vm.version Java Virtual Machine implementation version
(8) Java.vm.vendor Java Virtual machine implementation provider
(9) Java.vm.name Java Virtual machine implementation name
(java.specification.version) Java Runtime Environment specification version
(one) Java.specification.vendor Java Runtime Environment specification provider
(java.specification.name) Java Runtime Environment specification name
(java.class.version) Java class format version number
Java.class.path Java classpath
(Java.library.path) List of paths to search when loading libraries
(JAVA.IO.TMPDIR) The default temporary file path
(Java.compiler) The name of the JIT compiler to use
Java.ext.dirs the path of one or more extended directories
(os.name) Name of the operating system
(os.arch) Architecture of the operating system
(os.version) version of the operating system
File.separator file Delimiter ("/" in UNIX system)
(path.separator) path delimiter (":" In UNIX system)
Line.separator line Delimiter ("/n" in UNIX system)
(user.name) account name of the user
(+) User.home user's home directory
User.dir User's current working directory
The result of the actual call and output of the parameter
@Test
public void Testsystemgetproperty () {
System.out.println ("java.version-->" +system.getproperty ("java.version"));
System.out.println ("java.vendor-->" +system.getproperty ("Java.vendor"));
System.out.println ("java.vendor.url-->" +system.getproperty ("Java.vendor.url"));
System.out.println ("java.home-->" +system.getproperty ("Java.home"));
System.out.println ("ava.vm.specification.versionr-->" +system.getproperty ("ava.vm.specification.version"));
System.out.println ("java.vm.specification.vendor-->" +system.getproperty ("Java.vm.specification.vendor"));
System.out.println ("java.vm.specification.name-->" +system.getproperty ("Java.vm.specification.name"));
System.out.println ("java.vm.version-->" +system.getproperty ("java.vm.version"));
System.out.println ("java.vm.vendor-->" +system.getproperty ("Java.vm.vendor"));
System.out.println ("java.vm.name-->" +system.getproperty ("Java.vm.name"));
System.out.println ("java.specification.version-->" +system.getproperty ("java.specification.version"));
System.out.println ("java.specification.vendor-->" +system.getproperty ("Java.specification.vendor"));
System.out.println ("java.specification.name-->" +system.getproperty ("Java.specification.namer"));
System.out.println ("java.class.version-->" +system.getproperty ("java.class.version"));
System.out.println ("java.class.path-->" +system.getproperty ("Java.class.path"));
System.out.println ("java.library.path-->" +system.getproperty ("Java.library.path"));
System.out.println ("java.io.tmpdir-->" +system.getproperty ("Java.io.tmpdir"));
System.out.println ("java.compiler-->" +system.getproperty ("Java.compiler"));
System.out.println ("java.ext.dirs-->" +system.getproperty ("Java.ext.dirs"));
System.out.println ("os.name-->" +system.getproperty ("Os.name"));
System.out.println ("os.arch-->" +system.getproperty ("Os.arch"));
System.out.println ("os.version-->" +system.getproperty ("os.version"));
System.out.println ("file.separator-->" +system.getproperty ("File.separator"));
System.out.println ("path.separator-->" +system.getproperty ("Path.separator"));
System.out.println ("line.separator-->" +system.getproperty ("Line.separator"));
System.out.println ("user.name-->" +system.getproperty ("User.Name"));
System.out.println ("user.home-->" +system.getproperty ("User.home"));
System.out.println ("user.dir-->" +system.getproperty ("User.dir"));
}
-------------------------is the result of the output-----------------------------
java.version-->1.7.0_79
Java.vendor-->oracle Corporation
java.vendor.url-->http://java.oracle.com/
Java.home-->d:\kassdev\jdk1.7\jre
Ava.vm.specification.versionr-->null
Java.vm.specification.vendor-->oracle Corporation
Java.vm.specification.name-->java Virtual Machine Specification
Java.vm.version-->24.79-b02
Java.vm.vendor-->oracle Corporation
Java.vm.name-->java HotSpot (TM) Client VM
java.specification.version-->1.7
Java.specification.vendor-->oracle Corporation
Java.specification.name-->null
java.class.version-->51.0
java.class.path-->d:\workspace\myeclipse\webtest01\webroot\web-inf\classes;d:\software\myeclipse\common\ plugins\org.junit4_4.5.0.v20090824\junit.jar;d:\software\myeclipse\common\plugins\org.hamcrest.core_1.1.0. V20090501071000.jar;/d:/software/myeclipse/myeclipse 8.5/configuration/org.eclipse.osgi/bundles/642/1/.cp/;/d:/ Software/myeclipse/myeclipse 8.5/configuration/org.eclipse.osgi/bundles/640/1/.cp/;/d:/software/myeclipse/ MyEclipse 8.5/configuration/org.eclipse.osgi/bundles/641/1/.cp/
java.library.path-->d:\kassdev\jdk1.7\bin; C:\WINDOWS\Sun\Java\bin; C:\WINDOWS\system32; C:\windows;d:/software/myeclipse/common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin/client;d:/software /myeclipse/common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin; C:\Program Files (x86) \intel\icls client\; C:\Program Files\intel\icls client\; C:\WINDOWS\system32; C:\WINDOWS; C:\WINDOWS\System32\Wbem; C:\WINDOWS\System32\WindowsPowerShell\v1.0\; C:\Program Files\intel\intel (R) Management Engine components\dal; C:\Program Files\intel\intel (R) Management Engine components\ipt; C:\Program Files (x86) \intel\intel (R) Management Engine components\dal; C:\Program Files (x86) \intel\intel (R) Management Engine components\ipt; C:\Program Files (x86) \nvidia corporation\physx\common;d:\kassdev\kass\jdk1.7\bin;d:\devtools\tortoisesvn\bin;d:\ Soft\ultraedit;d:\soft\nodejs\;D: \software\apache-ant-1.9.6\bin;d:\software\python;d:\kassdev\kass\jdk1.7\jre\ Bin;d:\kassdev\jdk1.7\bin;d:\software\ssh; C:\Users\Tom\AppDATA\ROAMING\NPM;.
Java.io.tmpdir-->c:\users\tom\appdata\local\temp\
Java.compiler-->null
java.ext.dirs-->d:\kassdev\jdk1.7\jre\lib\ext; C:\WINDOWS\Sun\Java\lib\ext
Os.name-->windows 8.1
Os.arch-->x86
os.version-->6.3
File.separator-->\
path.separator-->;
Line.separator-->
User.name-->tom
User.home-->c:\users\tom
user.dir-->d:\workspace\myeclipse\webtest01
Summary: The above is a summary of the System.getproperty (), the reader can copy the code after testing to see their own computer test results.
Java System.getproperty () can get the value