来个java获得系统配置文件的
public class SystemProperties { public static void main(String[] args) { Properties properties = System.getProperties(); Iterator<Entry<Object, Object>> iterator = properties.entrySet().iterator(); while (iterator.hasNext()) { Entry<Object, Object> entry = iterator.next(); System.out.println(entry.getKey() + "===" + ntry.getValue()); } } }
结果:
java.runtime.name===Java(TM) SE Runtime Environment sun.boot.library.path===d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\bin java.vm.version===11.3-b02 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 1 java.vm.specification.name===Java Virtual Machine Specification user.dir===D:\Workspaces\TIMETEST java.runtime.version===1.6.0_13-b03 java.awt.graphicsenv===sun.awt.Win32GraphicsEnvironment java.endorsed.dirs===d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\endorsed os.arch===x86 java.io.tmpdir===C:\Users\koal\AppData\Local\Templine.separator=== java.vm.specification.vendor===Sun Microsystems Inc. user.variant=== os.name===Windows Vista sun.jnu.encoding===GBK java.library.path===d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;d:/MyEclipse 10.7/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin/client;d:/MyEclipse 10.7/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin;d:/MyEclipse 10.7/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/lib/i386;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64 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\koal user.timezone=== java.awt.printerjob===sun.awt.windows.WPrinterJob file.encoding===GBK java.specification.version===1.6 java.class.path===D:\Workspaces\TIMETEST\bin user.name===koal java.vm.specification.version===1.0 java.home===d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\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_13 java.ext.dirs===d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\ext;C:\Windows\Sun\Java\lib\ext sun.boot.class.path===d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\resources.jar;d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\rt.jar;d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\sunrsasign.jar;d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\jsse.jar;d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\jce.jar;d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\charsets.jar;d:\MyEclipse 10.7\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\classes 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
时间: 2024-10-13 12:43:46