Java获取特殊目录或特殊值

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:\soft\JAVA\jdk1.6.0_21\jre\bin
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:\soft\JAVA\jdk1.6.0_21\jre\lib\endorsed
os.arch-->x86
java.io.tmpdir-->C:\DOCUME~1\ADMINI~1\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-->E:\soft\JAVA\jdk1.6.0_21\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;E:\soft\JAVA\jdk1.6.0_21\bin;E:\soft\apache-maven-3.0.4\bin\;
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 Settings\Administrator
user.timezone-->
java.awt.printerjob-->sun.awt.windows.WPrinterJob
file.encoding-->GBK
java.specification.version-->1.6
java.class.path-->F:\httpclient\WebRoot\WEB-INF\classes
user.name-->Administrator
java.vm.specification.version-->1.0
java.home-->E:\soft\JAVA\jdk1.6.0_21\jre
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:\soft\JAVA\jdk1.6.0_21\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
sun.boot.class.path-->E:\soft\JAVA\jdk1.6.0_21\jre\lib\resources.jar;E:\soft\JAVA\jdk1.6.0_21\jre\lib\rt.jar;E:\soft\JAVA\jdk1.6.0_21\jre\lib\sunrsasign.jar;E:\soft\JAVA\jdk1.6.0_21\jre\lib\jsse.jar;E:\soft\JAVA\jdk1.6.0_21\jre\lib\jce.jar;E:\soft\JAVA\jdk1.6.0_21\jre\lib\charsets.jar;E:\soft\JAVA\jdk1.6.0_21\jre\classes;E:\soft\JAVA\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\1.4\activation.jar;E:\soft\JAVA\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\1.4\javax.servlet.jar;E:\soft\JAVA\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\1.4\javax.servlet.jsp.jar;E:\soft\JAVA\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\1.4\jboss-j2ee.jar;E:\soft\JAVA\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\1.4\jboss-jaxrpc.jar;E:\soft\JAVA\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\1.4\jboss-jsr77.jar;E:\soft\JAVA\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\1.4\jboss-saaj.jar;E:\soft\JAVA\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\1.4\mail.jar;E:\soft\JAVA\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\1.4\namespace.jar;E:\soft\JAVA\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\1.4\xml-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 Settings\Administrator
PATHEXT-->.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
ORACLE_HOME-->E:\soft\Ora10InstantClient
JAVA_HOME-->E:\soft\JAVA\jdk1.6.0_21
MAVEN_HOME-->E:\soft\apache-maven-3.0.4
TEMP-->C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp
SystemDrive-->C:
MOZ_PLUGIN_PATH-->E:\soft\Foxit\plugins\
ProgramFiles-->C:\Program Files
Path-->C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;E:\soft\JAVA\jdk1.6.0_21\bin;E:\soft\apache-maven-3.0.4\bin\;
HOMEDRIVE-->C:
PROCESSOR_REVISION-->0f0d
TNS_ADMIN-->E:\soft\Ora10InstantClient
CLIENTNAME-->Console
USERDOMAIN-->ELECTRUM006
ALLUSERSPROFILE-->C:\Documents and Settings\All Users
PROCESSOR_IDENTIFIER-->x86 Family 6 Model 15 Stepping 13, GenuineIntel
SESSIONNAME-->Console
TMP-->C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp
LOGONSERVER-->\\ELECTRUM006
CommonProgramFiles-->C:\Program Files\Common Files
PROCESSOR_ARCHITECTURE-->x86
FP_NO_HOST_CHECK-->NO
OS-->Windows_NT
HOMEPATH-->\Documents and Settings\Administrator
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:\WINDOWS\system32\cmd.exe
APPDATA-->C:\Documents and Settings\Administrator\Application Data

你可能感兴趣的:(java)