java.version |
Java 运行时环境版本 |
java.vendor |
Java 运行时环境供应商 |
java.vendor.url |
Java 供应商的 URL |
java.home |
Java 安装目录 |
java.vm.specification.version |
Java 虚拟机规范版本 |
java.vm.specification.vendor |
Java 虚拟机规范供应商 |
java.vm.specification.name |
Java 虚拟机规范名称 |
java.vm.version |
Java 虚拟机实现版本 |
java.vm.vendor |
Java 虚拟机实现供应商 |
java.vm.name |
Java 虚拟机实现名称 |
java.specification.version |
Java 运行时环境规范版本 |
java.specification.vendor |
Java 运行时环境规范供应商 |
java.specification.name |
Java 运行时环境规范名称 |
java.class.version |
Java 类格式版本号 |
java.class.path |
Java 类路径 |
java.library.path |
加载库时搜索的路径列表 |
java.io.tmpdir |
默认的临时文件路径 |
java.compiler |
要使用的 JIT 编译器的名称 |
java.ext.dirs |
一个或多个扩展目录的路径 |
os.name |
操作系统的名称 |
os.arch |
操作系统的架构 |
os.version |
操作系统的版本 |
file.separator |
文件分隔符(在 UNIX 系统中是“/”) |
file.encoding |
得到当前文件的编码格式 |
path.separator |
路径分隔符(在 UNIX 系统中是“:”) |
line.separator |
行分隔符(在 UNIX 系统中是“/n”) |
user.name |
用户的账户名称 |
user.home |
用户的主目录 |
user.dir |
用户的当前工作目录 |
利用System.getProperties().list(System.out);可以打出所有的key及值
输出结果:
-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=C:\Program Files\Java\jdk1.6.0\jre\bin
java.vm.version=1.6.0-beta2-b86
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
user.country=CN
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=Service Pack 3
java.vm.specification.name=Java Virtual Machine Specification
user.dir=E:\workspace\webProject
java.runtime.version=1.6.0-beta2-b86
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Program Files\Java\jdk1.6.0\jre\li...
os.arch=x86
java.io.tmpdir=C:\DOCUME~1\txb\LOCALS~1\Temp\
line.separator=
java.vm.specification.vendor=Sun Microsystems Inc.
user.variant=
os.name=Windows XP
sun.jnu.encoding=GBK
java.library.path=C:\Program Files\Java\jdk1.6.0\bin;.;...
java.specification.name=Java Platform API Specification
java.class.version=50.0
sun.management.compiler=HotSpot Client Compiler
os.version=5.1
user.home=C:\Documents and Settings\txb
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=UTF-8
java.specification.version=1.6
user.name=txb
java.class.path=E:\workspace\webProject\build\classes...
java.vm.specification.version=1.0
sun.arch.data.model=32
java.home=C:\Program Files\Java\jdk1.6.0\jre
java.specification.vendor=Sun Microsystems Inc.
user.language=zh
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode, sharing
java.version=1.6.0-beta2
java.ext.dirs=C:\Program Files\Java\jdk1.6.0\jre\li...
sun.boot.class.path=C:\Program Files\Java\jdk1.6.0\jre\li...
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=pentium_pro+mmx pentium_pro pentium+m...
public static void main(String[] args) { System.out.println("java_vendor:" + System.getProperty("java.vendor")); System.out.println("java_vendor_url:" + System.getProperty("java.vendor.url")); System.out.println("java_home:" + System.getProperty("java.home")); System.out.println("java_class_version:" + System.getProperty("java.class.version")); System.out.println("java_class_path:" + System.getProperty("java.class.path")); System.out.println("os_name:" + System.getProperty("os.name")); System.out.println("os_arch:" + System.getProperty("os.arch")); System.out.println("os_version:" + System.getProperty("os.version")); System.out.println("user_name:" + System.getProperty("user.name")); System.out.println("user_home:" + System.getProperty("user.home")); System.out.println("user_dir:" + System.getProperty("user.dir")); System.out.println("java_vm_specification_version:" + System.getProperty("java.vm.specification.version")); System.out.println("java_vm_specification_vendor:" + System.getProperty("java.vm.specification.vendor")); System.out.println("java_vm_specification_name:" + System.getProperty("java.vm.specification.name")); System.out.println("java_vm_version:" + System.getProperty("java.vm.version")); System.out.println("java_vm_vendor:" + System.getProperty("java.vm.vendor")); System.out.println("java_vm_name:" + System.getProperty("java.vm.name")); System.out.println("java_ext_dirs:" + System.getProperty("java.ext.dirs")); System.out.println("file_separator:" + System.getProperty("file.separator"));
System.out.println("file.encoding:" + System.getProperty("file.encoding"));
System.out.println("path_separator:" + System.getProperty("path.separator")); System.out.println("line_separator:" + System.getProperty("line.separator")); } /*输出结果: java_vendor:Sun Microsystems Inc. java_vendor_url:http://java.sun.com/ java_home:C:\Program Files\Java\jre6 java_class_version:50.0 java_class_path:E:\workspace\test\bin os_name:Windows XP os_arch:x86 os_version:5.1 user_name:txb user_home:C:\Documents and Settings\txb user_dir:E:\workspace\test java_vm_specification_version:1.0 java_vm_specification_vendor:Sun Microsystems Inc. java_vm_specification_name:Java Virtual Machine Specification java_vm_version:19.1-b02 java_vm_vendor:Sun Microsystems Inc. java_vm_name:Java HotSpot(TM) Client VM java_ext_dirs:C:\Program Files\Java\jre6\lib\ext;C:\WINDOWS\Sun\Java\lib\ext file_separator:\
file.encoding:UTF-8 path_separator:; line_separator: */