Java基础 之 System.getProperty()方法大全
1 public static void main(String[] args) { 2 System.out.println("java版本号:" + System.getProperty("java.version")); // java版本号 3 System.out.println("Java提供商名称:" + System.getProperty("java.vendor")); // Java提供商名称 4 System.out.println("Java提供商网站:" + System.getProperty("java.vendor.url")); // Java提供商网站 5 System.out.println("jre目录:" + System.getProperty("java.home")); // Java,哦,应该是jre目录 6 System.out.println("Java虚拟机规范版本号:" + System.getProperty("java.vm.specification.version")); // Java虚拟机规范版本号 7 System.out.println("Java虚拟机规范提供商:" + System.getProperty("java.vm.specification.vendor")); // Java虚拟机规范提供商 8 System.out.println("Java虚拟机规范名称:" + System.getProperty("java.vm.specification.name")); // Java虚拟机规范名称 9 System.out.println("Java虚拟机版本号:" + System.getProperty("java.vm.version")); // Java虚拟机版本号 10 System.out.println("Java虚拟机提供商:" + System.getProperty("java.vm.vendor")); // Java虚拟机提供商 11 System.out.println("Java虚拟机名称:" + System.getProperty("java.vm.name")); // Java虚拟机名称 12 System.out.println("Java规范版本号:" + System.getProperty("java.specification.version")); // Java规范版本号 13 System.out.println("Java规范提供商:" + System.getProperty("java.specification.vendor")); // Java规范提供商 14 System.out.println("Java规范名称:" + System.getProperty("java.specification.name")); // Java规范名称 15 System.out.println("Java类版本号:" + System.getProperty("java.class.version")); // Java类版本号 16 System.out.println("Java类路径:" + System.getProperty("java.class.path")); // Java类路径 17 System.out.println("Java lib路径:" + System.getProperty("java.library.path")); // Java lib路径 18 System.out.println("Java输入输出临时路径:" + System.getProperty("java.io.tmpdir")); // Java输入输出临时路径 19 System.out.println("Java编译器:" + System.getProperty("java.compiler")); // Java编译器 20 System.out.println("Java执行路径:" + System.getProperty("java.ext.dirs")); // Java执行路径 21 System.out.println("操作系统名称:" + System.getProperty("os.name")); // 操作系统名称 22 System.out.println("操作系统的架构:" + System.getProperty("os.arch")); // 操作系统的架构 23 System.out.println("操作系统版本号:" + System.getProperty("os.version")); // 操作系统版本号 24 System.out.println("文件分隔符:" + System.getProperty("file.separator")); // 文件分隔符 25 System.out.println("路径分隔符:" + System.getProperty("path.separator")); // 路径分隔符 26 System.out.println("直线分隔符:" + System.getProperty("line.separator")); // 直线分隔符 27 System.out.println("操作系统用户名:" + System.getProperty("user.name")); // 用户名 28 System.out.println("操作系统用户的主目录:" + System.getProperty("user.home")); // 用户的主目录 29 System.out.println("当前程序所在目录:" + System.getProperty("user.dir")); // 当前程序所在目录 30 }
输出结果为:
1 java版本号:1.7.0_71 2 Java提供商名称:Oracle Corporation 3 Java提供商网站:http://java.oracle.com/ 4 jre目录:C:Program FilesJavajdk1.7.0_71jre 5 Java虚拟机规范版本号:1.7 6 Java虚拟机规范提供商:Oracle Corporation 7 Java虚拟机规范名称:Java Virtual Machine Specification 8 Java虚拟机版本号:24.71-b01 9 Java虚拟机提供商:Oracle Corporation 10 Java虚拟机名称:Java HotSpot(TM) 64-Bit Server VM 11 Java规范版本号:1.7 12 Java规范提供商:Oracle Corporation 13 Java规范名称:Java Platform API Specification 14 Java类版本号:51.0 15 Java类路径:D:myworkcocopaymanager argetclasses;D:myworkcocopaycommons argetclasses;D:softlocalRepositoryorgapachelogginglog4jlog4j-core2.0.1log4j-core-2.0.1.jar;D:softlocalRepositoryorgapachelogginglog4jlog4j-1.2-api2.0.1log4j-1.2-api-2.0.1.jar;D:softlocalRepositoryorgapachelogginglog4jlog4j-slf4j-impl2.0.1log4j-slf4j-impl-2.0.1.jar;D:myworkcocopaysecurity argetclasses;D:softlocalRepositorycommons-loggingcommons-logging1.2commons-logging-1.2.jar;D:myworkcocopaymm-api argetclasses;D:softlocalRepositoryorgjibxjibx-bind1.2.5jibx-bind-1.2.5.jar;D:softlocalRepositorycelcel5.1cel-5.1.jar;D:softlocalRepository egexp egexp1.2 egexp-1.2.jar;D:softlocalRepositorylog4jlog4j1.2.17log4j-1.2.17.jar;D:softlocalRepositorycom houghtworksqdoxqdox1.12.1qdox-1.12.1.jar;D:softlocalRepositoryorgjibxjibx-tools1.2.5jibx-tools-1.2.5.jar;D:softlocalRepositoryorgjibxconfig3rdpartyorgeclipseorg.eclipse.core.contenttype3.4.100.v20110423-0524org.eclipse.core.contenttype-3.4.100.v20110423-0524.jar;D:softlocalRepositoryorgjibxconfig3rdpartyorgeclipseorg.eclipse.core.jobs3.5.100.v20110404org.eclipse.core.jobs-3.5.100.v20110404.jar;D:softlocalRepositoryorgjibxconfig3rdpartyorgeclipseorg.eclipse.core.resources3.7.100.v20110510-0712org.eclipse.core.resources-3.7.100.v20110510-0712.jar;D:softlocalRepositoryorgjibxconfig3rdpartyorgeclipseorg.eclipse.core.runtime3.7.0.v20110110org.eclipse.core.runtime-3.7.0.v20110110.jar;D:softlocalRepositoryorgjibxconfig3rdpartyorgeclipseorg.eclipse.equinox.common3.6.0.v20110523org.eclipse.equinox.common-3.6.0.v20110523.jar;D:softlocalRepositoryorgjibxconfig3rdpartyorgeclipseorg.eclipse.equinox.preferences3.4.0.v20110502org.eclipse.equinox.preferences-3.4.0.v20110502.jar;D:softlocalRepositoryorgjibxconfig3rdpartyorgeclipseorg.eclipse.jdt.core3.7.0.v_B61org.eclipse.jdt.core-3.7.0.v_B61.jar;D:softlocalRepositoryorgjibxconfig3rdpartyorgeclipseorg.eclipse.osgi3.7.0.v20110613org.eclipse.osgi-3.7.0.v20110613.jar;D:softlocalRepositoryorgjibxconfig3rdpartyorgeclipseorg.eclipse.text3.5.100.v20110505-0800org.eclipse.text-3.5.100.v20110505-0800.jar;D:softlocalRepositoryorgjibxjibx-schema1.2.5jibx-schema-1.2.5.jar;D:softlocalRepositoryorgjibxjibx-extras1.2.5jibx-extras-1.2.5.jar;D:softlocalRepositoryorgjdomjdom1.1.3jdom-1.1.3.jar;D:softlocalRepositoryjavaxservletjspjsp-api2.1jsp-api-2.1.jar;D:softlocalRepositoryorgspringframeworkspring-context4.1.1.RELEASEspring-context-4.1.1.RELEASE.jar;D:softlocalRepositoryorgspringframeworkspring-aop4.1.1.RELEASEspring-aop-4.1.1.RELEASE.jar;D:softlocalRepositoryorgspringframeworkspring-beans4.1.1.RELEASEspring-beans-4.1.1.RELEASE.jar;D:softlocalRepositoryorgspringframeworkspring-core4.1.1.RELEASEspring-core-4.1.1.RELEASE.jar;D:softlocalRepositoryorgspringframeworkspring-expression4.1.1.RELEASEspring-expression-4.1.1.RELEASE.jar;D:softlocalRepositoryorgspringframeworkspring-web4.1.1.RELEASEspring-web-4.1.1.RELEASE.jar;D:softlocalRepositoryorgspringframeworkspring-webmvc4.1.1.RELEASEspring-webmvc-4.1.1.RELEASE.jar;D:softlocalRepositoryorgspringframeworkspring-test4.1.1.RELEASEspring-test-4.1.1.RELEASE.jar;D:softlocalRepositoryorgspringframeworkspring-context-support4.1.1.RELEASEspring-context-support-4.1.1.RELEASE.jar;D:softlocalRepositoryorgspringframeworksecurityspring-security-core3.2.4.RELEASEspring-security-core-3.2.4.RELEASE.jar;D:softlocalRepositoryaopallianceaopalliance1.0aopalliance-1.0.jar;D:softlocalRepositoryorgspringframeworksecurityspring-security-config3.2.4.RELEASEspring-security-config-3.2.4.RELEASE.jar;D:softlocalRepositoryorgspringframeworksecurityspring-security-web3.2.4.RELEASEspring-security-web-3.2.4.RELEASE.jar;D:softlocalRepositoryorgspringframeworksecurityspring-security-taglibs3.2.4.RELEASEspring-security-taglibs-3.2.4.RELEASE.jar;D:softlocalRepositoryorgspringframeworksecurityspring-security-acl3.2.4.RELEASEspring-security-acl-3.2.4.RELEASE.jar;D:softlocalRepositoryorgspringframeworkspring-jdbc4.1.1.RELEASEspring-jdbc-4.1.1.RELEASE.jar;D:softlocalRepositoryorgaspectjaspectjweaver1.8.1aspectjweaver-1.8.1.jar;D:softlocalRepositoryorgapachelogginglog4jlog4j-api2.0.1log4j-api-2.0.1.jar;D:softlocalRepositoryjstljstl1.2jstl-1.2.jar;D:softlocalRepository aglibsstandard1.1.2standard-1.1.2.jar;D:softlocalRepositoryorgmybatismybatis-spring1.2.2mybatis-spring-1.2.2.jar;D:softlocalRepositoryorgmybatismybatis3.2.8mybatis-3.2.8.jar;D:softlocalRepositoryorgapachecommonscommons-dbcp22.0.1commons-dbcp2-2.0.1.jar;D:softlocalRepositoryorgapachecommonscommons-pool22.2commons-pool2-2.2.jar;D:softlocalRepositorymysqlmysql-connector-java5.1.33mysql-connector-java-5.1.33.jar;D:softlocalRepositorycommons-iocommons-io2.0commons-io-2.0.jar;D:softlocalRepositorycommons-langcommons-lang2.6commons-lang-2.6.jar;D:softlocalRepositorycommons-fileuploadcommons-fileupload1.2.1commons-fileupload-1.2.1.jar;D:softlocalRepositorycommons-collectionscommons-collections3.2.1commons-collections-3.2.1.jar;D:softlocalRepositoryorgapache omcatservlet-api6.0.39servlet-api-6.0.39.jar;D:softlocalRepositoryvelocityvelocity1.5velocity-1.5.jar;D:softlocalRepositoryorooro2.0.8oro-2.0.8.jar;D:softlocalRepositoryorgapache iles iles-core2.2.2 iles-core-2.2.2.jar;D:softlocalRepositoryorgapache iles iles-api2.2.2 iles-api-2.2.2.jar;D:softlocalRepositorycommons-digestercommons-digester2.0commons-digester-2.0.jar;D:softlocalRepositorycommons-beanutilscommons-beanutils1.8.0commons-beanutils-1.8.0.jar;D:softlocalRepositoryorgapache iles iles-jsp2.2.2 iles-jsp-2.2.2.jar;D:softlocalRepositoryorgapache iles iles-servlet2.2.2 iles-servlet-2.2.2.jar;D:softlocalRepositoryorgapache iles iles-template2.2.2 iles-template-2.2.2.jar;D:softlocalRepositorydom4jdom4j1.6dom4j-1.6.jar;D:softlocalRepository etsfopencsvopencsv2.3opencsv-2.3.jar;D:softlocalRepositoryorgapachepoipoi3.9poi-3.9.jar;D:softlocalRepositorycommons-codeccommons-codec1.9commons-codec-1.9.jar;D:softlocalRepositoryorgapachepoipoi-ooxml3.9poi-ooxml-3.9.jar;D:softlocalRepositoryorgapachepoipoi-ooxml-schemas3.9poi-ooxml-schemas-3.9.jar;D:softlocalRepositoryorgapachexmlbeansxmlbeans2.3.0xmlbeans-2.3.0.jar;D:softlocalRepositorystaxstax-api1.0.1stax-api-1.0.1.jar;D:softlocalRepositoryorgquartz-schedulerquartz2.2.1quartz-2.2.1.jar;D:softlocalRepositoryc3p0c3p0 .9.1.1c3p0-0.9.1.1.jar;D:softlocalRepositoryorgslf4jslf4j-api1.6.6slf4j-api-1.6.6.jar;D:softlocalRepositoryorgquartz-schedulerquartz-jobs2.2.1quartz-jobs-2.2.1.jar;D:softlocalRepositorycomalibabafastjson1.1.41fastjson-1.1.41.jar;D:softlocalRepository etsfehcacheehcache2.7.0ehcache-2.7.0.jar;D:softlocalRepository etsfehcacheehcache-core2.6.5ehcache-core-2.6.5.jar;D:softlocalRepositoryorgspringframeworksecurityspring-security-cas-client3.0.8.RELEASEspring-security-cas-client-3.0.8.RELEASE.jar;D:softlocalRepositoryorgspringframeworkspring-tx4.1.1.RELEASEspring-tx-4.1.1.RELEASE.jar;D:softlocalRepositoryorgjasigcascas-client-core3.1.10cas-client-core-3.1.10.jar;D:softlocalRepositoryxml-apisxml-apis1.4.01xml-apis-1.4.01.jar;D:softlocalRepositoryorgapachecommonscommons-compress1.3commons-compress-1.3.jar;D:softlocalRepositoryorgjibxjibx-run1.2.5jibx-run-1.2.5.jar;D:softlocalRepositoryjoda-timejoda-time2.1joda-time-2.1.jar;D:softlocalRepositoryxpp3xpp31.1.3.4.Oxpp3-1.1.3.4.O.jar;D:softlocalRepositorycomjcraftjsch .1.51jsch-0.1.51.jar;D:softlocalRepositoryorgapachehttpcomponentshttpclient4.3.5httpclient-4.3.5.jar;D:softlocalRepositoryorgapachehttpcomponentshttpcore4.3.2httpcore-4.3.2.jar;D:softlocalRepositoryorgimgscalrimgscalr-lib4.2imgscalr-lib-4.2.jar 16 Java lib路径:C:Program FilesJavajdk1.7.0_71jrein;C:WindowsSunJavain;C:Windowssystem32;C:Windows;E:softappcanAppCanStudioPersonalV3.1HDKemulatormas;C:Program Files (x86)Common FilesNetSarang;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;D:apache-tomcat-7.0.55in;D:apache-tomcat-7.0.55lib;D:Program Filesapache-maven-3.2.2in;E:softspring-roo-1.3.1.RC1in;;. 17 Java输入输出临时路径:C:UsersADMINI~1AppDataLocalTemp 18 Java编译器:null 19 Java执行路径:C:Program FilesJavajdk1.7.0_71jrelibext;C:WindowsSunJavalibext 20 操作系统名称:Windows 7 21 操作系统的架构:amd64 22 操作系统版本号:6.1 23 文件分隔符: 24 路径分隔符:; 25 直线分隔符: 26 27 操作系统用户名:Administrator 28 操作系统用户的主目录:C:UsersAdministrator 29 当前程序所在目录:D:myworkcocopaymanager