Java获取系统基础参数信息
一、JVM已经帮我们读取了系统信息
public void testSystemParam(){ Properties p = System.getProperties(); Iterator it = p.entrySet().iterator(); while(it.hasNext()){ Map.Entry entry = (Map.Entry) it.next(); System.out.println(entry.getKey()+" : "+entry.getValue()); } }
二、Windows下的结果实例
java.runtime.name : Java(TM) SE Runtime Environment sun.boot.library.path : C:\Program Files\Java\jdk1.8.0_141\jre\bin java.vm.version : 25.141-b15 java.vm.vendor : Oracle Corporation java.vendor.url : http://java.oracle.com/ path.separator : ; java.vm.name : Java HotSpot(TM) 64-Bit Server VM file.encoding.pkg : sun.io user.country : CN user.script : sun.java.launcher : SUN_STANDARD sun.os.patch.level : PID : 2352 java.vm.specification.name : Java Virtual Machine Specification user.dir : E:\workspace-idea-git\utms-client\utms-c-worker java.runtime.version : 1.8.0_141-b15 java.awt.graphicsenv : sun.awt.Win32GraphicsEnvironment java.endorsed.dirs : C:\Program Files\Java\jdk1.8.0_141\jre\lib\endorsed os.arch : amd64 java.io.tmpdir : C:\Users\kingsomg\AppData\Local\Temp\ line.separator : java.vm.specification.vendor : Oracle Corporation user.variant : os.name : Windows 10 sun.jnu.encoding : GBK spring.beaninfo.ignore : true java.library.path : C:\Program Files\Java\jdk1.8.0_141\bin;. java.specification.name : Java Platform API Specification java.class.version : 52.0 sun.management.compiler : HotSpot 64-Bit Tiered Compilers os.version : 10.0 user.home : C:\Users\kingsomg user.timezone : Asia/Shanghai java.awt.printerjob : sun.awt.windows.WPrinterJob file.encoding : UTF-8 java.specification.version : 1.8 java.class.path : D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.1\lib\idea_rt.jar; user.name : kingsomg java.vm.specification.version : 1.8 sun.java.command : com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.suning.test.EnvTest java.home : C:\Program Files\Java\jdk1.8.0_141\jre sun.arch.data.model : 64 user.language : zh java.specification.vendor : Oracle Corporation awt.toolkit : sun.awt.windows.WToolkit java.vm.info : mixed mode java.version : 1.8.0_141 java.ext.dirs : C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext;C:\Windows\Sun\Java\lib\ext sun.boot.class.path : C:\Program Files\Java\jdk1.8.0_141\jre\lib\resources.jar; java.awt.headless : true java.vendor : Oracle Corporation file.separator : \ java.vendor.url.bug : http://bugreport.sun.com/bugreport/ idea.test.cyclic.buffer.size : 1048576 sun.io.unicode.encoding : UnicodeLittle sun.cpu.endian : little sun.desktop : windows sun.cpu.isalist : amd64
上善若水,水利万物而不争。