前言:
在web编程技术内幕中看到一个用apache组件进行文件下载的例子,对于DiskFileUpload类的setRepositoryPath方法,设置临时文件的存放路径,里面指出如果不调用该方法指定绝对路径。那么会使用"java.io.tempdir"这个环境属性的值。想到前面没有遇到过这个环境属性,这里列举出所有环境属性。代码如下:
1 Properties properties = System.getProperties(); 2 Enumeration names = properties.propertyNames(); 3 String propertyName; 4 while (names.hasMoreElements()) { 5 propertyName = (String) names.nextElement(); 6 System.out.print(propertyName + ":"); 7 System.out.println(properties.getProperty(propertyName)); 8 }
运行结果如下:
1 java.runtime.name:Java(TM) SE Runtime Environment 2 sun.boot.library.path:E:\MyEclipse\JDK\1.8\jre\bin 3 java.vm.version:25.101-b13 4 java.vm.vendor:Oracle Corporation 5 java.vendor.url:http://java.oracle.com/ 6 path.separator:; 7 java.vm.name:Java HotSpot(TM) 64-Bit Server VM 8 file.encoding.pkg:sun.io 9 idea.launcher.port:7535 10 user.script: 11 user.country:CN 12 sun.java.launcher:SUN_STANDARD 13 sun.os.patch.level:Service Pack 1 14 java.vm.specification.name:Java Virtual Machine Specification 15 user.dir:E:\MyEclipse\workspace\ScriptEngine 16 java.runtime.version:1.8.0_101-b13 17 java.awt.graphicsenv:sun.awt.Win32GraphicsEnvironment 18 java.endorsed.dirs:E:\MyEclipse\JDK\1.8\jre\lib\endorsed 19 os.arch:amd64 20 java.io.tmpdir:C:\Users\ADMINI~1\AppData\Local\Temp\ 21 line.separator: 22 23 java.vm.specification.vendor:Oracle Corporation 24 user.variant: 25 os.name:Windows 7 26 sun.jnu.encoding:GBK 27 java.library.path:E:\MyEclipse\JDK\1.8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;E:\Tools\jruby-9.1.2.0\bin;E:\MyEclipse\JDK\1.8\bin;C:\ProgramData\Oracle\Java\javapath;E:\Tools\jruby-9.1.2.0\bin;E:\Tools\Python3.6\Scripts\;E:\Tools\Python3.6\;. 28 java.specification.name:Java Platform API Specification 29 java.class.version:52.0 30 sun.management.compiler:HotSpot 64-Bit Tiered Compilers 31 os.version:6.1 32 user.home:C:\Users\Administrator 33 user.timezone: 34 java.awt.printerjob:sun.awt.windows.WPrinterJob 35 java.specification.version:1.8 36 file.encoding:UTF-8 37 idea.launcher.bin.path:E:\IntelliJ IDEA 2016.2.2\bin 38 user.name:Administrator 39 java.class.path:E:\MyEclipse\workspace\ScriptEngine\bin;E:\Tools\jpython\jython.jar;E:\MyEclipse\JDK\1.8\jre\lib\charsets.jar;E:\MyEclipse\JDK\1.8\jre\lib\deploy.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\access-bridge-64.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\cldrdata.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\dnsns.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\jaccess.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\jfxrt.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\localedata.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\nashorn.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\sunec.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\sunjce_provider.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\sunmscapi.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\sunpkcs11.jar;E:\MyEclipse\JDK\1.8\jre\lib\ext\zipfs.jar;E:\MyEclipse\JDK\1.8\jre\lib\javaws.jar;E:\MyEclipse\JDK\1.8\jre\lib\jce.jar;E:\MyEclipse\JDK\1.8\jre\lib\jfr.jar;E:\MyEclipse\JDK\1.8\jre\lib\jfxswt.jar;E:\MyEclipse\JDK\1.8\jre\lib\jsse.jar;E:\MyEclipse\JDK\1.8\jre\lib\management-agent.jar;E:\MyEclipse\JDK\1.8\jre\lib\plugin.jar;E:\MyEclipse\JDK\1.8\jre\lib\resources.jar;E:\MyEclipse\JDK\1.8\jre\lib\rt.jar;E:\Tools\jruby-9.1.2.0\lib\jruby.jar;E:\IntelliJ IDEA 2016.2.2\lib\idea_rt.jar 40 java.vm.specification.version:1.8 41 sun.arch.data.model:64 42 java.home:E:\MyEclipse\JDK\1.8\jre 43 sun.java.command:com.intellij.rt.execution.application.AppMain TestRuby 44 java.specification.vendor:Oracle Corporation 45 user.language:zh 46 awt.toolkit:sun.awt.windows.WToolkit 47 java.vm.info:mixed mode 48 java.version:1.8.0_101 49 java.ext.dirs:E:\MyEclipse\JDK\1.8\jre\lib\ext;C:\Windows\Sun\Java\lib\ext 50 sun.boot.class.path:E:\MyEclipse\JDK\1.8\jre\lib\resources.jar;E:\MyEclipse\JDK\1.8\jre\lib\rt.jar;E:\MyEclipse\JDK\1.8\jre\lib\sunrsasign.jar;E:\MyEclipse\JDK\1.8\jre\lib\jsse.jar;E:\MyEclipse\JDK\1.8\jre\lib\jce.jar;E:\MyEclipse\JDK\1.8\jre\lib\charsets.jar;E:\MyEclipse\JDK\1.8\jre\lib\jfr.jar;E:\MyEclipse\JDK\1.8\jre\classes 51 java.vendor:Oracle Corporation 52 file.separator:\ 53 java.vendor.url.bug:http://bugreport.sun.com/bugreport/ 54 sun.cpu.endian:little 55 sun.io.unicode.encoding:UnicodeLittle 56 sun.desktop:windows 57 sun.cpu.isalist:amd64
黎明前最黑暗,成功前最绝望!