System.getProperty的使用
嗯,我们先看一下JDK 里如何讲:
自己执行一下:
public void getSystemKey(){ File sysFile = new File("d:/study","sysFile.properties"); Properties sysPro = System.getProperties(); try { sysPro.store(new FileOutputStream(sysFile), "Properties ClASS"); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
输出:
#Properties ClASS #Wed Mar 18 16:04:29 CST 2015 java.runtime.name=Java(TM) SE Runtime Environment sun.boot.library.path=D\:\\InstallFiles\\Genuitec\\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= java.vm.specification.name=Java Virtual Machine Specification user.dir=D\:\\workspace\\study\\2015-3-17Java-FileUpDown java.runtime.version=1.6.0_13-b03 java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment java.endorsed.dirs=D\:\\InstallFiles\\Genuitec\\Common\\binary\\com.sun.java.jdk.win32.x86_1.6.0.013\\jre\\lib\\endorsed os.arch=x86 java.io.tmpdir=C\:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\ line.separator=\r\n java.vm.specification.vendor=Sun Microsystems Inc. user.variant= os.name=Windows Vista sun.jnu.encoding=GBK java.library.path=D\:\\InstallFiles\\Genuitec\\Common\\binary\\com.sun.java.jdk.win32.x86_1.6.0.013\\bin;.;C\:\\Windows\\Sun\\Java\\bin;C\:\\Windows\\system32;C\:\\Windows;D\:/InstallFiles/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin/client;D\:/InstallFiles/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin;C\:\\ProgramData\\Oracle\\Java\\javapath;C\:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C\:\\Windows\\system32;C\:\\Windows;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;D\:\\InstallFiles\\dzpk\\Java\\jdk1.6.0_24\\lib java.specification.name=Java Platform API Specification java.class.version=50.0 sun.management.compiler=HotSpot Client Compiler os.version=6.2 user.home=C\:\\Users\\Administrator user.timezone=Asia/Shanghai java.awt.printerjob=sun.awt.windows.WPrinterJob file.encoding=GBK java.specification.version=1.6 java.class.path=D\:\\workspace\\study\\2015-3-17Java-FileUpDown\\WebRoot\\WEB-INF\\classes;D\:\\workspace\\study\\2015-3-17Java-FileUpDown\\WebRoot\\WEB-INF\\lib\\poi-3.11-20141221.jar;D\:\\workspace\\study\\2015-3-17Java-FileUpDown\\WebRoot\\WEB-INF\\lib\\commons-logging-1.1.3.jar;D\:\\workspace\\study\\2015-3-17Java-FileUpDown\\WebRoot\\WEB-INF\\lib\\junit-4.11.jar;D\:\\workspace\\study\\2015-3-17Java-FileUpDown\\WebRoot\\WEB-INF\\lib\\log4j-1.2.17.jar user.name=Administrator java.vm.specification.version=1.0 java.home=D\:\\InstallFiles\\Genuitec\\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\:\\InstallFiles\\Genuitec\\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\:\\InstallFiles\\Genuitec\\Common\\binary\\com.sun.java.jdk.win32.x86_1.6.0.013\\jre\\lib\\resources.jar;D\:\\InstallFiles\\Genuitec\\Common\\binary\\com.sun.java.jdk.win32.x86_1.6.0.013\\jre\\lib\\rt.jar;D\:\\InstallFiles\\Genuitec\\Common\\binary\\com.sun.java.jdk.win32.x86_1.6.0.013\\jre\\lib\\sunrsasign.jar;D\:\\InstallFiles\\Genuitec\\Common\\binary\\com.sun.java.jdk.win32.x86_1.6.0.013\\jre\\lib\\jsse.jar;D\:\\InstallFiles\\Genuitec\\Common\\binary\\com.sun.java.jdk.win32.x86_1.6.0.013\\jre\\lib\\jce.jar;D\:\\InstallFiles\\Genuitec\\Common\\binary\\com.sun.java.jdk.win32.x86_1.6.0.013\\jre\\lib\\charsets.jar;D\:\\InstallFiles\\Genuitec\\Common\\binary\\com.sun.java.jdk.win32.x86_1.6.0.013\\jre\\classes;D\:\\InstallFiles\\Genuitec\\Common\\plugins\\com.genuitec.eclipse.j2eedt.core_8.6.1.me201010211225\\data\\libraryset\\EE_5\\javaee.jar;D\:\\InstallFiles\\Genuitec\\Common\\plugins\\com.genuitec.eclipse.j2eedt.core_8.6.1.me201010211225\\data\\libraryset\\EE_5\\jsf-impl.jar;D\:\\InstallFiles\\Genuitec\\Common\\plugins\\com.genuitec.eclipse.j2eedt.core_8.6.1.me201010211225\\data\\libraryset\\EE_5\\jsf-api.jar;D\:\\InstallFiles\\Genuitec\\Common\\plugins\\com.genuitec.eclipse.j2eedt.core_8.6.1.me201010211225\\data\\libraryset\\EE_5\\jstl-1.2.jar 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
加油,愿被这世界温柔以待 ^_^