获得所有java System属性,实验所得,非文档拷贝,最全

package job; import java.util.Enumeration; import java.util.TreeMap; public class SysProperties { /** * @author shijin * @param args */ public static void main(String[] args) { //先获得系统属性的Properties对象,继而获得所有Property名称的枚举 Enumeration e = System.getProperties().propertyNames(); //TreeMap是SortedMap的现阶段唯一实现,保证key有序;用来有序地保存系统属性 TreeMap ptmap = new TreeMap(); while(e.hasMoreElements()) { String key = (String)e.nextElement(); String value = System.getProperty(key); ptmap.put(key, value); } for(String key : ptmap.keySet()) { //格式化输出,第一个字符串左对齐,宽30 System.out.format("%-30s%s", key,ptmap.get(key)); System.out.println(); } } }

输出:

awt.toolkit sun.awt.windows.WToolkit file.encoding GBK file.encoding.pkg sun.io file.separator \ java.awt.graphicsenv sun.awt.Win32GraphicsEnvironment java.awt.printerjob sun.awt.windows.WPrinterJob java.class.path E:\JAVA\workplace\j2eeworkspace\tools\bin java.class.version 50.0 java.endorsed.dirs C:\Program Files\Java\jre6\lib\endorsed java.ext.dirs C:\Program Files\Java\jre6\lib\ext;C:\WINDOWS\Sun\Java\lib\ext java.home C:\Program Files\Java\jre6 java.io.tmpdir C:\DOCUME~1\shijin\LOCALS~1\Temp\ java.library.path C:\Program Files\Java\jre6\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;H:\app\shijin\product\11.1.0\db_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;C:\Program Files\Java\jdk1.6.0_13\bin;C:\Program Files\Java\jdk1.6.0_13\jre\bin;C:\Program Files\PuTTY;;C:\Program Files\MySQL\MySQL Server 5.0\bin;;C:\Program Files\DBank\ClickUp;C:\Program Files\DBank\ClickUp;H:\eclipse-jee-indigo-SR2-win32\eclipse;;. java.runtime.name Java(TM) SE Runtime Environment java.runtime.version 1.6.0_26-b03 java.specification.name Java Platform API Specification java.specification.vendor Sun Microsystems Inc. java.specification.version 1.6 java.vendor Sun Microsystems Inc. java.vendor.url http://java.sun.com/ java.vendor.url.bug http://java.sun.com/cgi-bin/bugreport.cgi java.version 1.6.0_26 java.vm.info mixed mode, sharing java.vm.name Java HotSpot(TM) Client VM java.vm.specification.name Java Virtual Machine Specification java.vm.specification.vendor Sun Microsystems Inc. java.vm.specification.version 1.0 java.vm.vendor Sun Microsystems Inc. java.vm.version 20.1-b02 line.separator os.arch x86 os.name Windows XP os.version 5.1 path.separator ; sun.arch.data.model 32 sun.boot.class.path C:\Program Files\Java\jre6\lib\resources.jar;C:\Program Files\Java\jre6\lib\rt.jar;C:\Program Files\Java\jre6\lib\sunrsasign.jar;C:\Program Files\Java\jre6\lib\jsse.jar;C:\Program Files\Java\jre6\lib\jce.jar;C:\Program Files\Java\jre6\lib\charsets.jar;C:\Program Files\Java\jre6\lib\modules\jdk.boot.jar;C:\Program Files\Java\jre6\classes sun.boot.library.path C:\Program Files\Java\jre6\bin sun.cpu.endian little sun.cpu.isalist pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86 sun.desktop windows sun.io.unicode.encoding UnicodeLittle sun.java.command job.SysProperties sun.java.launcher SUN_STANDARD sun.jnu.encoding GBK sun.management.compiler HotSpot Client Compiler sun.os.patch.level Service Pack 2 user.country CN user.dir E:\JAVA\workplace\j2eeworkspace\tools user.home C:\Documents and Settings\shijin user.language zh user.name shijin user.timezone user.variant

你可能感兴趣的:(java,runtime,开发工具)