Java获取特殊目录或特殊值
2013-10-23 20:05:43 来源:WEB开发网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
更多精彩
赞助商链接