public static void main(String[] args) { System.out.println("java_version:" + System.getProperty("java.version"));//java运行时环境版本 System.out.println("java_vendor:" + System.getProperty("java.vendor"));//java运行时环境供应商 System.out.println("java_vendor_url:"+ System.getProperty("java.vendor.url"));//java供应商的url System.out.println("java_home:" + System.getProperty("java.home"));//java的安装目录 System.out.println("java_vm_specification_version:"+ System.getProperty("java.vm.specification.version"));//java虚拟机规范版本 System.out.println("java_vm_specification_vendor:"+ System.getProperty("java.vm.specification.vendor"));//java虚拟机规范供应商 System.out.println("java_vm_specification_name:"+ System.getProperty("java.vm.specification.name"));//java虚拟机规范名称 System.out.println("java_vm_version:"+ System.getProperty("java.vm.version"));//java虚拟机实现的版本 System.out.println("java_vm_vendor:"+ System.getProperty("java.vm.vendor"));//java虚拟机实现的供应商 System.out.println("java_vm_name:" + System.getProperty("java.vm.name"));//java虚拟机实现的名称 System.out.println("java_specification_version:"+ System.getProperty("java.specification.version"));//java运行时环境规范的版本 System.out.println("java_specification_vendor:"+ System.getProperty("java.specification.vendor"));//java运行时环境规范的供应商 System.out.println("java_specification_name:" + System.getProperty("java.specification.name"));//java运行时环境规范的名称 System.out.println("java_class_version:"+ System.getProperty("java.class.version"));//java类格式的版本号(也就是jdk1.7对应的版本) System.out.println("java_class_path:"+ System.getProperty("java.class.path"));//java类的路径,一般是java_home/bin System.out.println("java_library_path:" + System.getProperty("java.library.path"));//加载库时搜索的路径列表 System.out.println("java_io_tmpdir:"+ System.getProperty("java.io.tmpdir"));//默认的临时文件路径 System.out.println("java_compiler:"+ System.getProperty("java.compiler"));//要使用的jit编译器的名字 System.out.println("java_ext_dirs:"+ System.getProperty("java.ext.dirs"));//一个或多个扩展目录的路径 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("file_separator:"+ System.getProperty("file.separator"));//文件分隔符 System.out.println("path_separator:"+ System.getProperty("path.separator"));//路径分隔符 System.out.println("line_separator:"+ System.getProperty("line.separator"));//行分隔符 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"));//用户的当前工作目录 }
结果是
java_version:1.7.0_45 java_vendor:Oracle Corporation java_vendor_url:http://java.oracle.com/ java_home:/home/tp/MyEclipse Professional 2014/binary/com.sun.java.jdk7.linux.x86_64_1.7.0.u45/jre java_vm_specification_version:1.7 java_vm_specification_vendor:Oracle Corporation java_vm_specification_name:Java Virtual Machine Specification java_vm_version:24.45-b08 java_vm_vendor:Oracle Corporation java_vm_name:Java HotSpot(TM) 64-Bit Server VM java_specification_version:1.7 java_specification_vendor:Oracle Corporation java_specification_name:Java Platform API Specification java_class_version:51.0 java_class_path:/home/tp/Workspaces/MyEclipse Professional 2014/algorithm/bin java_library_path:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib java_io_tmpdir:/tmp java_compiler:null java_ext_dirs:/home/tp/MyEclipse Professional 2014/binary/com.sun.java.jdk7.linux.x86_64_1.7.0.u45/jre/lib/ext:/usr/java/packages/lib/ext os_name:Linux os_arch:amd64 os_version:4.4.0-62-generic file_separator:/ path_separator:: line_separator: user_name:tp user_home:/home/tp user_dir:/home/tp/Workspaces/MyEclipse Professional 2014/algorithm