java 可以获取的系统变量列表

在编程的时候,我们经常要获得系统的环境变量。因为环境变量太多了,往往我们会迷茫不知所措。

下面的代码可以打印出这些环境变量:

public static void printSystemProperties(){
		System.getProperties( ).list(System.out);
	}

 输出下面的结果:

-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=C:\jdk\x64\jdk1.6.0_45\jre\bin
java.vm.version=20.45-b01
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=;
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg=sun.io
user.country=CN
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=Service Pack 1
java.vm.specification.name=Java Virtual Machine Specification
user.dir=E:\java_workspace\Test
java.runtime.version=1.6.0_45-b06
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\jdk\x64\jdk1.6.0_45\jre\lib\endorsed
os.arch=amd64
java.io.tmpdir=C:\Users\kanpiaoxue\AppData\Local\Temp\
line.separator=

java.vm.specification.vendor=Sun Microsystems Inc.
user.variant=
os.name=Windows 7
sun.jnu.encoding=GBK
java.library.path=C:\jdk\x64\jdk1.6.0_45\bin;C:\Windows...
java.specification.name=Java Platform API Specification
java.class.version=50.0
sun.management.compiler=HotSpot 64-Bit Tiered Compilers
os.version=6.1
user.home=C:\Users\kanpiaoxue
user.timezone=Asia/Shanghai
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=UTF-8
java.specification.version=1.6
user.name=kanpiaoxue
java.class.path=E:\java_workspace\Test\bin;E:\workspa...
java.vm.specification.version=1.0
sun.arch.data.model=64
java.home=C:\jdk\x64\jdk1.6.0_45\jre
sun.java.command=com.wanmei.test.Test
java.specification.vendor=Sun Microsystems Inc.
user.language=zh
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.6.0_45
java.ext.dirs=C:\jdk\x64\jdk1.6.0_45\jre\lib\ext;C:...
sun.boot.class.path=C:\jdk\x64\jdk1.6.0_45\jre\lib\resour...
java.vendor=Sun Microsystems Inc.
file.separator=\
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.desktop=windows
sun.cpu.isalist=amd64

 

你可能感兴趣的:(java)