Java代码获取所有系统属性

Java代码获取所有系统属性:

Properties props = System.getProperties();

Iterator<Entry<Object, Object>> it = props.entrySet().iterator();

while(it.hasNext()) {

Entry<Object, Object> ent = it.next();

System.out.println(ent.getKey() + ":" + ent.getValue());

}

在我的电脑上(Mac Leopard 10.5.8)的输出如下:

java.runtime.name:Java(TM) SE Runtime Environment

sun.boot.library.path:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries

java.vm.version:14.1-b02-92

awt.nativeDoubleBuffering:true

gopherProxySet:false

java.vm.vendor:Apple Inc.

java.vendor.url:http://www.apple.com/

path.separator::

java.vm.name:Java HotSpot(TM) 64-Bit Server VM

file.encoding.pkg:sun.io

sun.java.launcher:SUN_STANDARD

user.country:CN

sun.os.patch.level:unknown

java.vm.specification.name:Java Virtual Machine Specification

user.dir:/Users/mazhao/Documents/Dropbox/Dropbox/Development/Java/EBookMgr

java.runtime.version:1.6.0_15-b03-226

java.awt.graphicsenv:apple.awt.CGraphicsEnvironment

java.endorsed.dirs:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/endorsed

os.arch:x86_64

java.io.tmpdir:/var/folders/uA/uA4dEjP9HBWOk+6ULKESZk+++TI/-Tmp-/

line.separator:

java.vm.specification.vendor:Sun Microsystems Inc.

os.name:Mac OS X

sun.jnu.encoding:EUC_CN

java.library.path:.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

java.specification.name:Java Platform API Specification

java.class.version:50.0

sun.management.compiler:HotSpot 64-Bit Server Compiler

os.version:10.5.8

http.nonProxyHosts:local|*.local|169.254/16|*.169.254/16

user.home:/Users/mazhao

user.timezone:

java.awt.printerjob:apple.awt.CPrinterJob

file.encoding:UTF-8

java.specification.version:1.6

java.class.path:/Users/mazhao/Documents/Dropbox/Dropbox/Development/Java/EBookMgr/lib/OfficeLnFs_2.7.jar:/Users/mazhao/Documents/Dropbox/Dropbox/Development/Java/EBookMgr/build/classes:/Users/mazhao/Documents/Dropbox/Dropbox/Development/Java/EBookMgr/src

user.name:mazhao

java.vm.specification.version:1.0

java.home:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

sun.arch.data.model:64

user.language:zh

java.specification.vendor:Sun Microsystems Inc.

awt.toolkit:apple.awt.CToolkit

java.vm.info:mixed mode

java.version:1.6.0_15

java.ext.dirs:/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext

sun.boot.class.path:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jsfd.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Resources/Java/JavaRuntimeSupport.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/ui.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/laf.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/sunrsasign.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jsse.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jce.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/charsets.jar

java.vendor:Apple Inc.

file.separator:/

java.vendor.url.bug:http://bugreport.apple.com/

sun.io.unicode.encoding:UnicodeLittle

sun.cpu.endian:little

mrj.version:1050.1.6.0_15-226

socksNonProxyHosts:local|*.local|169.254/16|*.169.254/16

ftp.nonProxyHosts:local|*.local|169.254/16|*.169.254/16

sun.cpu.isalist:

你可能感兴趣的:(java,apple,OS,ext,sun)