public static void main(String[] args) {
Properties properties = System.getProperties() ; for(Map.Entry<?, ?> entry : properties.entrySet()){ System.out.println( entry.getKey() + "-->" + entry.getValue() ); } System.out.println( System.getProperty("##########################") ); Map<String , String> map = System.getenv() ; for(Map.Entry<?, ?> entry : map.entrySet()){ System.out.println( entry.getKey() + "-->" + entry.getValue() ) ; } }
系統輸出這樣的結果:
java.runtime.name-->Java(TM) SE Runtime Environment
sun.boot.library.path-->E:softJAVAjdk1.6.0_21jrebin
java.vm.version-->17.0-b17
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-->F:httpclient
java.runtime.version-->1.6.0_21-b07
java.awt.graphicsenv-->sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs-->E:softJAVAjdk1.6.0_21jrelibendorsed
os.arch-->x86
java.io.tmpdir-->C:DOCUME~1ADMINI~1LOCALS~1Temp
line.separator-->
java.vm.specification.vendor-->Sun Microsystems Inc.
user.variant-->
os.name-->Windows XP
sun.jnu.encoding-->GBK
java.library.path-->E:softJAVAjdk1.6.0_21bin;.;C:WINDOWSSunJavabin;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;E:softJAVAjdk1.6.0_21bin;E:softapache-maven-3.0.4bin;
java.specification.name-->Java Platform API Specification
java.class.version-->50.0
sun.management.compiler-->HotSpot Client Compiler
os.version-->5.1
user.home-->C:Documents and SettingsAdministrator
user.timezone-->
java.awt.printerjob-->sun.awt.windows.WPrinterJob
file.encoding-->GBK
java.specification.version-->1.6
java.class.path-->F:httpclientWebRootWEB-INFclasses
user.name-->Administrator
java.vm.specification.version-->1.0
java.home-->E:softJAVAjdk1.6.0_21jre
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
java.version-->1.6.0_21
java.ext.dirs-->E:softJAVAjdk1.6.0_21jrelibext;C:WINDOWSSunJavalibext
sun.boot.class.path-->E:softJAVAjdk1.6.0_21jrelibresources.jar;E:softJAVAjdk1.6.0_21jrelibrt.jar;E:softJAVAjdk1.6.0_21jrelibsunrsasign.jar;E:softJAVAjdk1.6.0_21jrelibjsse.jar;E:softJAVAjdk1.6.0_21jrelibjce.jar;E:softJAVAjdk1.6.0_21jrelibcharsets.jar;E:softJAVAjdk1.6.0_21jreclasses;E:softJAVAMyEclipsemyeclipseeclipsepluginscom.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806datalibraryset1.4activation.jar;E:softJAVAMyEclipsemyeclipseeclipsepluginscom.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806datalibraryset1.4javax.servlet.jar;E:softJAVAMyEclipsemyeclipseeclipsepluginscom.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806datalibraryset1.4javax.servlet.jsp.jar;E:softJAVAMyEclipsemyeclipseeclipsepluginscom.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806datalibraryset1.4jboss-j2ee.jar;E:softJAVAMyEclipsemyeclipseeclipsepluginscom.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806datalibraryset1.4jboss-jaxrpc.jar;E:softJAVAMyEclipsemyeclipseeclipsepluginscom.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806datalibraryset1.4jboss-jsr77.jar;E:softJAVAMyEclipsemyeclipseeclipsepluginscom.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806datalibraryset1.4jboss-saaj.jar;E:softJAVAMyEclipsemyeclipseeclipsepluginscom.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806datalibraryset1.4mail.jar;E:softJAVAMyEclipsemyeclipseeclipsepluginscom.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806datalibraryset1.4namespace.jar;E:softJAVAMyEclipsemyeclipseeclipsepluginscom.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806datalibraryset1.4xml-apis.jar
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
null
USERPROFILE-->C:Documents and SettingsAdministrator
PATHEXT-->.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
ORACLE_HOME-->E:softOra10InstantClient
JAVA_HOME-->E:softJAVAjdk1.6.0_21
MAVEN_HOME-->E:softapache-maven-3.0.4
TEMP-->C:DOCUME~1ADMINI~1LOCALS~1Temp
SystemDrive-->C:
MOZ_PLUGIN_PATH-->E:softFoxitplugins
ProgramFiles-->C:Program Files
Path-->C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;E:softJAVAjdk1.6.0_21bin;E:softapache-maven-3.0.4bin;
HOMEDRIVE-->C:
PROCESSOR_REVISION-->0f0d
TNS_ADMIN-->E:softOra10InstantClient
CLIENTNAME-->Console
USERDOMAIN-->ELECTRUM006
ALLUSERSPROFILE-->C:Documents and SettingsAll Users
PROCESSOR_IDENTIFIER-->x86 Family 6 Model 15 Stepping 13, GenuineIntel
SESSIONNAME-->Console
TMP-->C:DOCUME~1ADMINI~1LOCALS~1Temp
LOGONSERVER-->ELECTRUM006
CommonProgramFiles-->C:Program FilesCommon Files
PROCESSOR_ARCHITECTURE-->x86
FP_NO_HOST_CHECK-->NO
OS-->Windows_NT
HOMEPATH-->Documents and SettingsAdministrator
PROCESSOR_LEVEL-->6
1830B7BD-F7A3-4c4d-989B-C004DE465EDE-->1f4:bd918
COMPUTERNAME-->ELECTRUM006
windir-->C:WINDOWS
SystemRoot-->C:WINDOWS
NUMBER_OF_PROCESSORS-->2
USERNAME-->Administrator
NLS_LANG-->SIMPLIFIED CHINESE_CHINA.ZHS16GBK
ComSpec-->C:WINDOWSsystem32cmd.exe
APPDATA-->C:Documents and SettingsAdministratorApplication Data