System.getProperties().list(System.out);
如果要获取某一个属性,例如常见的“操作系统”
则 System.getProperty("os.name");
输出如下
java.runtime.name=Java(TM) SE Runtime Environment,
sun.boot.library.path=C:Program Files (x86)Javajre7in,
java.vm.version=24.80-b11,
java.vm.vendor=Oracle Corporation,
java.vendor.url=http://java.oracle.com/,
path.separator=;,
java.vm.name=Java HotSpot(TM) Client VM,
file.encoding.pkg=sun.io,
user.country=CN,
user.script=,
sun.java.launcher=SUN_STANDARD,
sun.os.patch.level=Service Pack 1,
java.vm.specification.name=Java Virtual Machine Specification,
user.dir=F:workspaceworkspace_venusVirtualDesktopTest,
java.runtime.version=1.7.0_80-b15,
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment,
java.endorsed.dirs=C:Program Files (x86)Javajre7libendorsed,
os.arch=x86,
java.io.tmpdir=C:UsersADMINI~1AppDataLocalTemp\,
line.separator=
,
java.vm.specification.vendor=Oracle Corporation,
user.variant=,
os.name=Windows 7,
sun.jnu.encoding=GBK,
java.library.path=C:Program Files (x86)Javajre7in;C:WindowsSunJavain;C:Windowssystem32;C:Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:UsersAdministrator ellerdevice;E:installOracleproduct11.2.0client_1;E:installOracleproduct11.2.0dbhome_1in;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;.;C:Program Files (x86)Javajdk1.6.0_45in;.;C:Program Files (x86)Javajdk1.6.0_45jrein;C:Program Files (x86)mavenapache-maven-3.2.5;C:Program Files (x86)mavenapache-maven-3.2.5in;E:Program FilesVisualSVN Serverin;E:Program FilesTortoiseSVNin;E:Program Files
odejs;F:PLATFORMantin;C:UsersAdministratorAppDataRoaming
pm;F:eclipseeclipse3.7;;.,
java.specification.name=Java Platform API Specification,
java.class.version=51.0,
sun.management.compiler=HotSpot Client Compiler,
os.version=6.1,
user.home=C:UsersAdministrator,
user.timezone=,
java.awt.printerjob=sun.awt.windows.WPrinterJob,
file.encoding=UTF-8,
java.specification.version=1.7,
java.class.path=F:workspaceworkspace_venusVirtualDesktopTestin,
user.name=Administrator,
java.vm.specification.version=1.7,
sun.java.command=com.zs.SystemProperty,
java.home=C:Program Files (x86)Javajre7,
sun.arch.data.model=32,
user.language=zh,
java.specification.vendor=Oracle Corporation,
awt.toolkit=sun.awt.windows.WToolkit,
java.vm.info=mixed mode,
java.version=1.7.0_80,
java.ext.dirs=C:Program Files (x86)Javajre7libext;C:WindowsSunJavalibext,
sun.boot.class.path=C:Program Files (x86)Javajre7lib
esources.jar;C:Program Files (x86)Javajre7lib
t.jar;C:Program Files (x86)Javajre7libsunrsasign.jar;C:Program Files (x86)Javajre7libjsse.jar;C:Program Files (x86)Javajre7libjce.jar;C:Program Files (x86)Javajre7libcharsets.jar;C:Program Files (x86)Javajre7libjfr.jar;C:Program Files (x86)Javajre7classes,
java.vendor=Oracle Corporation,
file.separator=\,
java.vendor.url.bug=http://bugreport.sun.com/bugreport/,
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