/** * 书本:《Thinking In Java》 * 功能:得到系统的环境变量 * 文件:EnvironmentVariables.java * 时间:2015年4月8日19:39:08 * 作者:cutter_point */ package Lesson11holdingyourobjects; import java.util.Map; public class EnvironmentVariables { public static void main(String [] args) { for(Map.Entry entry : System.getenv().entrySet()) { System.out.println(entry.getKey() + " : " + entry.getValue()); } } }
我的系统环境变量暴露一下,哈哈:
USERPROFILE : C:\Users\feng
PATHEXT : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
JAVA_HOME : G:\Program Files\Java\jdk1.8.0_40
PROGRAMDATA : C:\ProgramData
PROGRAMFILES(X86) : C:\Program Files (x86)
TEMP : C:\Users\feng\AppData\Local\Temp
COMMONPROGRAMFILES : C:\Program Files\Common Files
HOMEDRIVE : C:
PROCESSOR_REVISION : 3c03
SYSTEMDRIVE : C:
USERDOMAIN : xiao
ALLUSERSPROFILE : C:\ProgramData
PROGRAMW6432 : C:\Program Files
COMMONPROGRAMFILES(X86) : C:\Program Files (x86)\Common Files
PROCESSOR_IDENTIFIER : Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
SESSIONNAME : Console
TMP : C:\Users\feng\AppData\Local\Temp
PSMODULEPATH : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
CLASSPATH : .;G:\Program Files\Java\jdk1.8.0_40\lib\dt.jar;G:\Program Files\Java\jdk1.8.0_40\lib\tools.jar
LOGONSERVER : \\XIAO
PROCESSOR_ARCHITECTURE : AMD64
FP_NO_HOST_CHECK : NO
OS : Windows_NT
PATH : G:\MyEclipse Professional 2014\binary\com.sun.java.jdk7.win32.x86_64_1.7.0.u45\jre\bin;G:\Android\android-sdk-windows\tools;G:\php5.6;G:\php5.6\ext;G:\orcale\xiaofeng\product\12.1.0\dbhome_1\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;G:\Program
Files\Java\jdk1.8.0_40\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft
SQL Server\110\Tools\Binn\;C:\Program Files\MySQL\MySQL Enterprise Backup 3.11\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.3 & MySQL Utilities 1.5.3 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.3 & MySQL Utilities 1.5.3 1.5\Doctrine extensions for
PHP\
HOMEPATH : \Users\feng
PROMPT : $P$G
COMSPEC : C:\Windows\system32\cmd.exe
COMMONPROGRAMW6432 : C:\Program Files\Common Files
PROCESSOR_LEVEL : 6
USERDOMAIN_ROAMINGPROFILE : xiao
PROGRAMFILES : C:\Program Files
LOCALAPPDATA : C:\Users\feng\AppData\Local
VS120COMNTOOLS : G:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
COMPUTERNAME : XIAO
NUMBER_OF_PROCESSORS : 8
USERNAME : xiaofeng
SYSTEMROOT : C:\Windows
PUBLIC : C:\Users\Public
WINDIR : C:\Windows
APPDATA : C:\Users\feng\AppData\Roaming