欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

java获取所有系统变量

程序员文章站 2022-03-31 19:40:56
...
    public static void getSysProp(){
    	Properties props = System.getProperties();
    	Set<Entry<Object,Object>> res = props.entrySet();
        Iterator it = res.iterator(); 
        while (it.hasNext()) 
        {         
                Map.Entry e = (Map.Entry)it.next(); 
                System.out.println(e.getKey()+"="+e.getValue()); 
        }
    	
    }

 

 

java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition
sun.boot.library.path=C:\Program Files\Java\jre1.5.0_16\bin
java.vm.version=1.5.0_16-b02
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
sun.java.launcher=SUN_STANDARD
user.country=CN
sun.os.patch.level=Service Pack 3
java.vm.specification.name=Java Virtual Machine Specification
user.dir=D:\myeclipse-eclipse\workspace\JavaMail
java.runtime.version=1.5.0_16-b02
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Program Files\Java\jre1.5.0_16\lib\endorsed
os.arch=x86
java.io.tmpdir=C:\DOCUME~1\WEIJIA~1.ZHO\LOCALS~1\Temp\
line.separator=

java.vm.specification.vendor=Sun Microsystems Inc.
user.variant=
os.name=Windows XP
sun.jnu.encoding=GBK
java.library.path=lib目录
java.class.version=49.0
sun.management.compiler=HotSpot Client Compiler
os.version=5.1
user.home=用户目录
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=UTF-8
java.specification.version=1.5
java.class.path=classpath路径
user.name=用户名
java.vm.specification.version=1.0
java.home=C:\Program Files\Java\jre1.5.0_16
sun.arch.data.model=32
user.language=zh
java.specification.vendor=Sun Microsystems Inc.
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode, sharing
java.version=1.5.0_16
java.ext.dirs=C:\Program Files\Java\jre1.5.0_16\lib\ext
sun.boot.class.path=C:\Program Files\Java\jre1.5.0_16\lib\rt.jar;C:\Program Files\Java\jre1.5.0_16\lib\i18n.jar;C:\Program Files\Java\jre1.5.0_16\lib\sunrsasign.jar;C:\Program Files\Java\jre1.5.0_16\lib\jsse.jar;C:\Program Files\Java\jre1.5.0_16\lib\jce.jar;C:\Program Files\Java\jre1.5.0_16\lib\charsets.jar;C:\Program Files\Java\jre1.5.0_16\classes
java.vendor=Sun Microsystems Inc.
file.separator=\
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi
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