可以通过下面的代码获取到 java -D 的系统属性参数列表:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/** * @author michael * */ public class SystemInfo { /** * @param args */ public static void main(String[] args) { Properties prop = new Properties(System.getProperties()); // 在标准输出中输出系统属性的内容 prop.list(System.out); } } |
测试系统获取到的属性列表如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
-- listing properties -- java.runtime.name=Java(TM) SE Runtime Environment sun.boot.library.path=D:\jdk\jre\bin java.vm.version=16.0-b13 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 user.country=CN sun.java.launcher=SUN_STANDARD sun.os.patch.level=Service Pack 1 java.vm.specification.name=Java Virtual Machine Specification user.dir=D:\huaxia\study project\J2EE_sjsky\cu... java.runtime.version=1.6.0_18-b07 java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment java.endorsed.dirs=D:\jdk\jre\lib\endorsed os.arch=x86 java.io.tmpdir=C:\Users\Michael\AppData\Local\Temp\ line.separator= java.vm.specification.vendor=Sun Microsystems Inc. user.variant= os.name=Windows 7 sun.jnu.encoding=GBK java.library.path=D:\jdk\bin;.;C:\Windows\Sun\Java\bin;... java.specification.name=Java Platform API Specification java.class.version=50.0 sun.management.compiler=HotSpot Client Compiler os.version=6.1 user.home=C:\Users\Michael user.timezone= java.awt.printerjob=sun.awt.windows.WPrinterJob file.encoding=GBK java.specification.version=1.6 user.name=Michael java.class.path=D:\huaxia\study project\J2EE_sjsky\cu... java.vm.specification.version=1.0 sun.arch.data.model=32 java.home=D:\jdk\jre java.specification.vendor=Sun Microsystems Inc. user.language=zh awt.toolkit=sun.awt.windows.WToolkit java.vm.info=mixed mode java.version=1.6.0_18 java.ext.dirs=D:\jdk\jre\lib\ext;C:\Windows\Sun\Jav... sun.boot.class.path=D:\jdk\jre\lib\resources.jar;D:\jdk\j... java.vendor=Sun Microsystems Inc. file.separator=\ java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport... sun.cpu.endian=little sun.io.unicode.encoding=UnicodeLittle sun.desktop=windows sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+m... |
原创文章,转载请注明: 转载自micmiu – 软件开发+生活点滴[ http://www.micmiu.com/ ]
0 条评论。