码迷,mamicode.com
首页 > 编程语言 > 详细

java程序启动 环境属性的获取

时间:2018-03-07 15:09:31      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:time   class   lips   user   country   maven   cal   操作   sign   

System.getProperties().list(System.out);

如果要获取某一个属性,例如常见的“操作系统”

则  System.getProperty("os.name");

 

输出如下

java.runtime.name=Java(TM) SE Runtime Environment,
sun.boot.library.path=C:\Program Files (x86)\Java\jre7\bin,
java.vm.version=24.80-b11,
java.vm.vendor=Oracle Corporation,
java.vendor.url=http://java.oracle.com/,
path.separator=;,
java.vm.name=Java HotSpot(TM) Client VM,
file.encoding.pkg=sun.io,
user.country=CN,
user.script=,
sun.java.launcher=SUN_STANDARD,
sun.os.patch.level=Service Pack 1,
java.vm.specification.name=Java Virtual Machine Specification,
user.dir=F:\workspace\workspace_venus\VirtualDesktopTest,
java.runtime.version=1.7.0_80-b15,
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment,
java.endorsed.dirs=C:\Program Files (x86)\Java\jre7\lib\endorsed,
os.arch=x86,
java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\,
line.separator=
,
java.vm.specification.vendor=Oracle Corporation,
user.variant=,
os.name=Windows 7,
sun.jnu.encoding=GBK,
java.library.path=C:\Program Files (x86)\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Users\Administrator\teller\device;E:\installOracle\product\11.2.0\client_1;E:\installOracle\product\11.2.0\dbhome_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;.;C:\Program Files (x86)\Java\jdk1.6.0_45\bin;.;C:\Program Files (x86)\Java\jdk1.6.0_45\jre\bin;C:\Program Files (x86)\maven\apache-maven-3.2.5;C:\Program Files (x86)\maven\apache-maven-3.2.5\bin;E:\Program Files\VisualSVN Server\bin;E:\Program Files\TortoiseSVN\bin;E:\Program Files\nodejs\;F:\PLATFORM\ant\bin;C:\Users\Administrator\AppData\Roaming\npm;F:\eclipse\eclipse3.7;;.,
java.specification.name=Java Platform API Specification,
java.class.version=51.0,
sun.management.compiler=HotSpot Client Compiler,
os.version=6.1,
user.home=C:\Users\Administrator,
user.timezone=,
java.awt.printerjob=sun.awt.windows.WPrinterJob,
file.encoding=UTF-8,
java.specification.version=1.7,
java.class.path=F:\workspace\workspace_venus\VirtualDesktopTest\bin,
user.name=Administrator,
java.vm.specification.version=1.7,
sun.java.command=com.zs.SystemProperty,
java.home=C:\Program Files (x86)\Java\jre7,
sun.arch.data.model=32,
user.language=zh,
java.specification.vendor=Oracle Corporation,
awt.toolkit=sun.awt.windows.WToolkit,
java.vm.info=mixed mode,
java.version=1.7.0_80,
java.ext.dirs=C:\Program Files (x86)\Java\jre7\lib\ext;C:\Windows\Sun\Java\lib\ext,
sun.boot.class.path=C:\Program Files (x86)\Java\jre7\lib\resources.jar;C:\Program Files (x86)\Java\jre7\lib\rt.jar;C:\Program Files (x86)\Java\jre7\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jre7\lib\jsse.jar;C:\Program Files (x86)\Java\jre7\lib\jce.jar;C:\Program Files (x86)\Java\jre7\lib\charsets.jar;C:\Program Files (x86)\Java\jre7\lib\jfr.jar;C:\Program Files (x86)\Java\jre7\classes,
java.vendor=Oracle Corporation,
file.separator=\,
java.vendor.url.bug=http://bugreport.sun.com/bugreport/,
sun.io.unicode.encoding=UnicodeLittle,
sun.cpu.endian=little,
sun.desktop=windows,
sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86

java程序启动 环境属性的获取

标签:time   class   lips   user   country   maven   cal   操作   sign   

原文地址:https://www.cnblogs.com/cnblogszs/p/8521881.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!