Java基础 之 System.getProperty()方法

时间:2022-05-15 15:18:27

Java基础 之 System.getProperty()方法大全

 public static void main(String[] args) {
System.out.println("java版本号:" + System.getProperty("java.version")); // java版本号
System.out.println("Java提供商名称:" + System.getProperty("java.vendor")); // Java提供商名称
System.out.println("Java提供商网站:" + System.getProperty("java.vendor.url")); // Java提供商网站
System.out.println("jre目录:" + System.getProperty("java.home")); // Java,哦,应该是jre目录
System.out.println("Java虚拟机规范版本号:" + System.getProperty("java.vm.specification.version")); // Java虚拟机规范版本号
System.out.println("Java虚拟机规范提供商:" + System.getProperty("java.vm.specification.vendor")); // Java虚拟机规范提供商
System.out.println("Java虚拟机规范名称:" + System.getProperty("java.vm.specification.name")); // Java虚拟机规范名称
System.out.println("Java虚拟机版本号:" + System.getProperty("java.vm.version")); // Java虚拟机版本号
System.out.println("Java虚拟机提供商:" + System.getProperty("java.vm.vendor")); // Java虚拟机提供商
System.out.println("Java虚拟机名称:" + System.getProperty("java.vm.name")); // Java虚拟机名称
System.out.println("Java规范版本号:" + System.getProperty("java.specification.version")); // Java规范版本号
System.out.println("Java规范提供商:" + System.getProperty("java.specification.vendor")); // Java规范提供商
System.out.println("Java规范名称:" + System.getProperty("java.specification.name")); // Java规范名称
System.out.println("Java类版本号:" + System.getProperty("java.class.version")); // Java类版本号
System.out.println("Java类路径:" + System.getProperty("java.class.path")); // Java类路径
System.out.println("Java lib路径:" + System.getProperty("java.library.path")); // Java lib路径
System.out.println("Java输入输出临时路径:" + System.getProperty("java.io.tmpdir")); // Java输入输出临时路径
System.out.println("Java编译器:" + System.getProperty("java.compiler")); // Java编译器
System.out.println("Java执行路径:" + System.getProperty("java.ext.dirs")); // Java执行路径
System.out.println("操作系统名称:" + System.getProperty("os.name")); // 操作系统名称
System.out.println("操作系统的架构:" + System.getProperty("os.arch")); // 操作系统的架构
System.out.println("操作系统版本号:" + System.getProperty("os.version")); // 操作系统版本号
System.out.println("文件分隔符:" + System.getProperty("file.separator")); // 文件分隔符
System.out.println("路径分隔符:" + System.getProperty("path.separator")); // 路径分隔符
System.out.println("直线分隔符:" + System.getProperty("line.separator")); // 直线分隔符
System.out.println("操作系统用户名:" + System.getProperty("user.name")); // 用户名
System.out.println("操作系统用户的主目录:" + System.getProperty("user.home")); // 用户的主目录
System.out.println("当前程序所在目录:" + System.getProperty("user.dir")); // 当前程序所在目录
}

输出结果为:

 java版本号:1.7.0_71
Java提供商名称:Oracle Corporation
Java提供商网站:http://java.oracle.com/
jre目录:C:\Program Files\Java\jdk1.7.0_71\jre
Java虚拟机规范版本号:1.7
Java虚拟机规范提供商:Oracle Corporation
Java虚拟机规范名称:Java Virtual Machine Specification
Java虚拟机版本号:24.71-b01
Java虚拟机提供商:Oracle Corporation
Java虚拟机名称:Java HotSpot(TM) 64-Bit Server VM
Java规范版本号:1.7
Java规范提供商:Oracle Corporation
Java规范名称:Java Platform API Specification
Java类版本号:51.0
Java类路径:D:\mywork\cocopay\manager\target\classes;D:\mywork\cocopay\commons\target\classes;D:\soft\localRepository\org\apache\logging\log4j\log4j-core\2.0.1\log4j-core-2.0.1.jar;D:\soft\localRepository\org\apache\logging\log4j\log4j-1.2-api\2.0.1\log4j-1.2-api-2.0.1.jar;D:\soft\localRepository\org\apache\logging\log4j\log4j-slf4j-impl\2.0.1\log4j-slf4j-impl-2.0.1.jar;D:\mywork\cocopay\security\target\classes;D:\soft\localRepository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\mywork\cocopay\mm-api\target\classes;D:\soft\localRepository\org\jibx\jibx-bind\1.2.5\jibx-bind-1.2.5.jar;D:\soft\localRepository\bcel\bcel\5.1\bcel-5.1.jar;D:\soft\localRepository\regexp\regexp\1.2\regexp-1.2.jar;D:\soft\localRepository\log4j\log4j\1.2.17\log4j-1.2.17.jar;D:\soft\localRepository\com\thoughtworks\qdox\qdox\1.12.1\qdox-1.12.1.jar;D:\soft\localRepository\org\jibx\jibx-tools\1.2.5\jibx-tools-1.2.5.jar;D:\soft\localRepository\org\jibx\config\3rdparty\org\eclipse\org.eclipse.core.contenttype\3.4.100.v20110423-0524\org.eclipse.core.contenttype-3.4.100.v20110423-0524.jar;D:\soft\localRepository\org\jibx\config\3rdparty\org\eclipse\org.eclipse.core.jobs\3.5.100.v20110404\org.eclipse.core.jobs-3.5.100.v20110404.jar;D:\soft\localRepository\org\jibx\config\3rdparty\org\eclipse\org.eclipse.core.resources\3.7.100.v20110510-0712\org.eclipse.core.resources-3.7.100.v20110510-0712.jar;D:\soft\localRepository\org\jibx\config\3rdparty\org\eclipse\org.eclipse.core.runtime\3.7.0.v20110110\org.eclipse.core.runtime-3.7.0.v20110110.jar;D:\soft\localRepository\org\jibx\config\3rdparty\org\eclipse\org.eclipse.equinox.common\3.6.0.v20110523\org.eclipse.equinox.common-3.6.0.v20110523.jar;D:\soft\localRepository\org\jibx\config\3rdparty\org\eclipse\org.eclipse.equinox.preferences\3.4.0.v20110502\org.eclipse.equinox.preferences-3.4.0.v20110502.jar;D:\soft\localRepository\org\jibx\config\3rdparty\org\eclipse\org.eclipse.jdt.core\3.7.0.v_B61\org.eclipse.jdt.core-3.7.0.v_B61.jar;D:\soft\localRepository\org\jibx\config\3rdparty\org\eclipse\org.eclipse.osgi\3.7.0.v20110613\org.eclipse.osgi-3.7.0.v20110613.jar;D:\soft\localRepository\org\jibx\config\3rdparty\org\eclipse\org.eclipse.text\3.5.100.v20110505-0800\org.eclipse.text-3.5.100.v20110505-0800.jar;D:\soft\localRepository\org\jibx\jibx-schema\1.2.5\jibx-schema-1.2.5.jar;D:\soft\localRepository\org\jibx\jibx-extras\1.2.5\jibx-extras-1.2.5.jar;D:\soft\localRepository\org\jdom\jdom\1.1.3\jdom-1.1.3.jar;D:\soft\localRepository\javax\servlet\jsp\jsp-api\2.1\jsp-api-2.1.jar;D:\soft\localRepository\org\springframework\spring-context\4.1.1.RELEASE\spring-context-4.1.1.RELEASE.jar;D:\soft\localRepository\org\springframework\spring-aop\4.1.1.RELEASE\spring-aop-4.1.1.RELEASE.jar;D:\soft\localRepository\org\springframework\spring-beans\4.1.1.RELEASE\spring-beans-4.1.1.RELEASE.jar;D:\soft\localRepository\org\springframework\spring-core\4.1.1.RELEASE\spring-core-4.1.1.RELEASE.jar;D:\soft\localRepository\org\springframework\spring-expression\4.1.1.RELEASE\spring-expression-4.1.1.RELEASE.jar;D:\soft\localRepository\org\springframework\spring-web\4.1.1.RELEASE\spring-web-4.1.1.RELEASE.jar;D:\soft\localRepository\org\springframework\spring-webmvc\4.1.1.RELEASE\spring-webmvc-4.1.1.RELEASE.jar;D:\soft\localRepository\org\springframework\spring-test\4.1.1.RELEASE\spring-test-4.1.1.RELEASE.jar;D:\soft\localRepository\org\springframework\spring-context-support\4.1.1.RELEASE\spring-context-support-4.1.1.RELEASE.jar;D:\soft\localRepository\org\springframework\security\spring-security-core\3.2.4.RELEASE\spring-security-core-3.2.4.RELEASE.jar;D:\soft\localRepository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\soft\localRepository\org\springframework\security\spring-security-config\3.2.4.RELEASE\spring-security-config-3.2.4.RELEASE.jar;D:\soft\localRepository\org\springframework\security\spring-security-web\3.2.4.RELEASE\spring-security-web-3.2.4.RELEASE.jar;D:\soft\localRepository\org\springframework\security\spring-security-taglibs\3.2.4.RELEASE\spring-security-taglibs-3.2.4.RELEASE.jar;D:\soft\localRepository\org\springframework\security\spring-security-acl\3.2.4.RELEASE\spring-security-acl-3.2.4.RELEASE.jar;D:\soft\localRepository\org\springframework\spring-jdbc\4.1.1.RELEASE\spring-jdbc-4.1.1.RELEASE.jar;D:\soft\localRepository\org\aspectj\aspectjweaver\1.8.1\aspectjweaver-1.8.1.jar;D:\soft\localRepository\org\apache\logging\log4j\log4j-api\2.0.1\log4j-api-2.0.1.jar;D:\soft\localRepository\jstl\jstl\1.2\jstl-1.2.jar;D:\soft\localRepository\taglibs\standard\1.1.2\standard-1.1.2.jar;D:\soft\localRepository\org\mybatis\mybatis-spring\1.2.2\mybatis-spring-1.2.2.jar;D:\soft\localRepository\org\mybatis\mybatis\3.2.8\mybatis-3.2.8.jar;D:\soft\localRepository\org\apache\commons\commons-dbcp2\2.0.1\commons-dbcp2-2.0.1.jar;D:\soft\localRepository\org\apache\commons\commons-pool2\2.2\commons-pool2-2.2.jar;D:\soft\localRepository\mysql\mysql-connector-java\5.1.33\mysql-connector-java-5.1.33.jar;D:\soft\localRepository\commons-io\commons-io\2.0\commons-io-2.0.jar;D:\soft\localRepository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\soft\localRepository\commons-fileupload\commons-fileupload\1.2.1\commons-fileupload-1.2.1.jar;D:\soft\localRepository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;D:\soft\localRepository\org\apache\tomcat\servlet-api\6.0.39\servlet-api-6.0.39.jar;D:\soft\localRepository\velocity\velocity\1.5\velocity-1.5.jar;D:\soft\localRepository\oro\oro\2.0.8\oro-2.0.8.jar;D:\soft\localRepository\org\apache\tiles\tiles-core\2.2.2\tiles-core-2.2.2.jar;D:\soft\localRepository\org\apache\tiles\tiles-api\2.2.2\tiles-api-2.2.2.jar;D:\soft\localRepository\commons-digester\commons-digester\2.0\commons-digester-2.0.jar;D:\soft\localRepository\commons-beanutils\commons-beanutils\1.8.0\commons-beanutils-1.8.0.jar;D:\soft\localRepository\org\apache\tiles\tiles-jsp\2.2.2\tiles-jsp-2.2.2.jar;D:\soft\localRepository\org\apache\tiles\tiles-servlet\2.2.2\tiles-servlet-2.2.2.jar;D:\soft\localRepository\org\apache\tiles\tiles-template\2.2.2\tiles-template-2.2.2.jar;D:\soft\localRepository\dom4j\dom4j\1.6\dom4j-1.6.jar;D:\soft\localRepository\net\sf\opencsv\opencsv\2.3\opencsv-2.3.jar;D:\soft\localRepository\org\apache\poi\poi\3.9\poi-3.9.jar;D:\soft\localRepository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;D:\soft\localRepository\org\apache\poi\poi-ooxml\3.9\poi-ooxml-3.9.jar;D:\soft\localRepository\org\apache\poi\poi-ooxml-schemas\3.9\poi-ooxml-schemas-3.9.jar;D:\soft\localRepository\org\apache\xmlbeans\xmlbeans\2.3.0\xmlbeans-2.3.0.jar;D:\soft\localRepository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\soft\localRepository\org\quartz-scheduler\quartz\2.2.1\quartz-2.2.1.jar;D:\soft\localRepository\c3p0\c3p0\0.9.1.1\c3p0-0.9.1.1.jar;D:\soft\localRepository\org\slf4j\slf4j-api\1.6.6\slf4j-api-1.6.6.jar;D:\soft\localRepository\org\quartz-scheduler\quartz-jobs\2.2.1\quartz-jobs-2.2.1.jar;D:\soft\localRepository\com\alibaba\fastjson\1.1.41\fastjson-1.1.41.jar;D:\soft\localRepository\net\sf\ehcache\ehcache\2.7.0\ehcache-2.7.0.jar;D:\soft\localRepository\net\sf\ehcache\ehcache-core\2.6.5\ehcache-core-2.6.5.jar;D:\soft\localRepository\org\springframework\security\spring-security-cas-client\3.0.8.RELEASE\spring-security-cas-client-3.0.8.RELEASE.jar;D:\soft\localRepository\org\springframework\spring-tx\4.1.1.RELEASE\spring-tx-4.1.1.RELEASE.jar;D:\soft\localRepository\org\jasig\cas\cas-client-core\3.1.10\cas-client-core-3.1.10.jar;D:\soft\localRepository\xml-apis\xml-apis\1.4.01\xml-apis-1.4.01.jar;D:\soft\localRepository\org\apache\commons\commons-compress\1.3\commons-compress-1.3.jar;D:\soft\localRepository\org\jibx\jibx-run\1.2.5\jibx-run-1.2.5.jar;D:\soft\localRepository\joda-time\joda-time\2.1\joda-time-2.1.jar;D:\soft\localRepository\xpp3\xpp3\1.1.3.4.O\xpp3-1.1.3.4.O.jar;D:\soft\localRepository\com\jcraft\jsch\0.1.51\jsch-0.1.51.jar;D:\soft\localRepository\org\apache\httpcomponents\httpclient\4.3.5\httpclient-4.3.5.jar;D:\soft\localRepository\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;D:\soft\localRepository\org\imgscalr\imgscalr-lib\4.2\imgscalr-lib-4.2.jar
Java lib路径:C:\Program Files\Java\jdk1.7.0_71\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;E:\soft\appcan\AppCanStudioPersonalV3.1\HDK\emulator\mas\;C:\Program Files (x86)\Common Files\NetSarang;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\apache-tomcat-7.0.55\bin;D:\apache-tomcat-7.0.55\lib;D:\Program Files\apache-maven-3.2.2\bin;E:\soft\spring-roo-1.3.1.RC1\bin;;.
Java输入输出临时路径:C:\Users\ADMINI~1\AppData\Local\Temp\
Java编译器:null
Java执行路径:C:\Program Files\Java\jdk1.7.0_71\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
操作系统名称:Windows 7
操作系统的架构:amd64
操作系统版本号:6.1
文件分隔符:\
路径分隔符:;
直线分隔符: 操作系统用户名:Administrator
操作系统用户的主目录:C:\Users\Administrator
当前程序所在目录:D:\mywork\cocopay\manager