The Java platform uses a Poperties object to maintain its own configuration information. The system tear contains a properties object that describes the configuration of the current working environment. The System properties contains information about the current user, the current Java runtime version, the file path delimiter, and so on.
| Key |
meaning |
"file.separator" |
Character that separates the components of a file path. This is the "on / UNIX and" \ "on Windows. |
"java.class.path" |
Path used to find directories and JAR archives containing class files. Elements of the class path is separated by a platform-specific character specified in the property path.separator . |
"java.home" |
installation directory for Java Runtime environment (JRE) |
"java.vendor" |
JRE Vendor Name |
"java.vendor.url" |
JRE Vendor 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 injava.class.path |
"user.dir" |
User working Directory |
"user.home" |
User Home Directory |
"user.name" |
User account Name |
Actual data:
Public Static voidMain (String args[]) {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 ("Java_class_version:" + system.getproperty ("Java.class.version")); System.out.println ("Java_class_path:" + system.getproperty ("Java.class.path")); 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 ("User_name:" + system.getproperty ("User.Name")); System.out.println ("User_home:" + system.getproperty ("User.home")); System.out.println ("User_dir:" + system.getproperty ("User.dir")); System.out.println ("Java_vm_specification_version:" + system.getproperty ("Java.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_ext_dirs:" + system.getproperty ("Java.ext.dirs")); 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")); }
Output:
java_vendor:oracle corporationjava_vendor_url:http://java.oracle.com/Java_home:/library/java/javavirtualmachines/jdk1.7.0_79.jdk/contents/home/jrejava_class_version:51.0Java_class_path:/users/awp/documents/otherproject/myjmeterdemo/bin:/users/awp/documents/otherproject/myjmeterdemo/libs/ apachejmeter_core.jar:/users/awp/documents/otherproject/myjmeterdemo/libs/apachejmeter_java.jar:/users/awp/ documents/otherproject/myjmeterdemo/libs/jorphan-2.9. jar:/users/awp/documents/otherproject/myjmeterdemo/libs/logkit-1.2.2. jar:/users/awp/documents/otherproject/myjmeterdemo/libs/avalon-framework-api-4.3.1. jar:/users/awp/documents/otherproject/myjmeterdemo/libs/apachejmeter_http.jar:/users/awp/documents/ otherproject/myjmeterdemo/libs/oro-2.0.8. jar:/users/awp/documents/otherproject/myjmeterdemo/libs/commons-io-2.4. jar:/users/awp/documents/otherproject/myjmeterdemo/libs/commons-lang3-3.3.2. jar:/users/awp/documents/otherproject/myjmeterdemo/libs/xstream-1.5.0-SNAPSHOT.jaros_name:Mac OS xos_arch:x86_64os_version:10.10.5User_name:awpuser_home:/users/Awpuser_dir:/users/awp/documents/otherproject/myjmeterdemojava_vm_specification_version:1.7java_vm_specification_vendor:oracle Corporationjava_vm_specification_name:java Virtual Machine Specificationjava_vm_version:24.79-b02java_vm_vendor:oracle Corporationjava_vm_name:java HotSpot (TM) --Bit Server vmjava_ext_dirs:/users/awp/library/java/extensions:/library/java/javavirtualmachines/jdk1.7.0_79.jdk/contents/home/jre/lib/ext:/library/java/extensions:/network/library/java/extensions:/system/library/ java/extensions:/usr/lib/Javafile_separator:/Path_separator::line_separator:
Java-system.getproperty ()