Java-System.getProperty()
Java平台使用了一个Poperties对象来维护其自己的配置信息。System泪中包含有一个Properties对象用于描述当前工作环境的配置。系统properties包含了关于当前用户、当前Java运行时版本、文件路径分隔符等信息。
Key | Meaning |
---|---|
"file.separator" |
Character that separates components of a file path. This is "/ " on UNIX and "\ " on Windows. |
"java.class.path" |
Path used to find directories and JAR archives containing class files. Elements of the class path are separated by a platform-specific character specified in the path.separator property. |
"java.home" |
Installation directory for Java Runtime Environment (JRE) |
"java.vendor" |
JRE vendor name |
"java.vendor.url" |
JRE vendor URL |
"java.version" |
JRE version number |
"line.separator" |
Sequence used by operating system to separate lines in text files |
"os.arch" |
Operating system architecture |
"os.name" |
Operating system name |
"os.version" |
Operating system version |
"path.separator" |
Path separator character used in java.class.path |
"user.dir" |
User working directory |
"user.home" |
User home directory |
"user.name" |
User account name |
实际数据:
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("path_separator:" + System.getProperty("path.separator")); System.out.println("line_separator:" + System.getProperty("line.separator")); }
输出:
java_vendor:Oracle Corporation java_vendor_url:http://java.oracle.com/ java_home:/Library/Java/JavaVirtualMachines/jdk1..0_79.jdk/Contents/Home/jre java_class_version:51.0 java_class_path:/Users/awp/Documents/otherproject/MyJmeterDemo/bin:/Users/awp/Documents/otherproject/MyJmeterDemo/libs/ApacheJMeter_core.jar:/Users/awp/Documents/otherproject/MyJmeterDemo/libs/ApacheJMeter_java.jar:/Users/awp/Documents/otherproject/MyJmeterDemo/libs/jorphan-.jar:/Users/awp/Documents/otherproject/MyJmeterDemo/libs/avalon-framework-api-.jar:/Users/awp/Documents/otherproject/MyJmeterDemo/libs/ApacheJMeter_http.jar:/Users/awp/Documents/otherproject/MyJmeterDemo/libs/oro-.jar:/Users/awp/Documents/otherproject/MyJmeterDemo/libs/commons-io-.jar:/Users/awp/Documents/otherproject/MyJmeterDemo/libs/xstream--SNAPSHOT.jar os_name:Mac OS X os_arch:x86_64 os_version: user_name:awp user_home:/Users/awp user_dir:/Users/awp/Documents/otherproject/MyJmeterDemo java_vm_specification_version:1.7 java_vm_specification_vendor:Oracle Corporation java_vm_specification_name:Java Virtual Machine Specification java_vm_version:24.79-b02 java_vm_vendor:Oracle Corporation java_vm_name:Java HotSpot(TM) -Bit Server VM java_ext_dirs:/Users/awp/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1..0_79.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java file_separator:/ path_separator:: line_separator:
Java-System.getProperty()的更多相关文章
- java System.getProperty()参数大全
java.version Java Runtime Environment versionjava.vendor Java Runtime Environment vendorjava.vendor. ...
- Java System.getProperty()方法获取系统信息
用 System.getProperty()方法能获取到的系统信息: java.version Java 运行时环境版本 java.vendor Java 运行时环境供应商 java.vendor.u ...
- JAVA System.getProperty() 与 System.getenv() 差异及示例
System.getenv() 方法是获取指定的环境变量的值. System.getenv() 接收参数为任意字符串,当存在指定环境变量时即返回环境变量的值,否则返回null. System.getP ...
- Java system.getproperty获取环境属性
序号 属性 说明 1 java.version Java 运行时环境版本 2 java.vendor Java 运行时环境供应商 3 java.vendor.url Java 供应商的 URL 4 j ...
- Java System.getProperty("java.io.tmpdir") 获取系统临时目录
System.getProperty("java.io.tmpdir") 是获取操作系统的缓存临时目录 在windows7中的目录是: C:\Users\登录用户~1\AppDat ...
- Java System.getProperty vs System.getenv
转自:https://www.baeldung.com/java-system-get-property-vs-system-getenv 1. Introduction The package ja ...
- 获取当前应用的系统路径工具类和java的System.getProperty()方法介绍
java的System.getProperty()方法可以获取的值,如下: 对于Java程序,无论是未打包的还是打包的JAR或WAR文件,有时候都需要获取它运行所在目录信息,如何做到这一点呢? /** ...
- Java中系统属性Properties介绍 System.getProperty()参数大全
在JDK文档中System类中有这样的方法getProperties()在此方法的详细介绍中有下面的参数可供使用: java.version Java 运行时环境版本 java.vendor J ...
- 给java中的System.getProperty添加新的key value对
由于系统被格了,所以,现在的java项目配置不对,代码里面的配置类调用了一个System.getProperty("env")发现找不到该变量的值,以前一直能找到的. 其实就是以前 ...
- 在JAVA中 System.getProperty 和 System.setProperty 方法.
今天着手研究TOMCAT源码. 在刚開始的时候Startup类中init方法中调用非常多次System.getProperty和System.setProperty的方法. 后来经过网上搜索才得知,这 ...
随机推荐
- js 格式为2018-08-25 11:46:29 的日期比较方法
//判断日期,时间大小 function compareTime(startDate, endDate) { if (startDate.length > 0 && endDat ...
- oracle备份信息查询
SELECT TRIM(START_TIME || '#'), TRIM(END_TIME || '#'), TRIM(CASE OUTPUT_DEVICE_TYPE ...
- java 实现serialVersionUID
文章转自 https://www.cnblogs.com/duanxz/p/3511695.html 作用 serialVersionUID适用于Java的序列化机制.简单来说,Java的序列化机制 ...
- centos7 rpm 安装mysql
1.wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar 2.tar ...
- 如何在Qt Creator中添加库文件和头文件目录
在使用QtCreator开发图像处理程序的时候想加入Opencv库来处理图形,添加头文件,需要编辑工程文件夹下的.pro文件在文件中添加以下内容,即可包含头文件的文件夹: INCLUDEPATH += ...
- 乱入Linux界的我是如何学习的
欢迎来到建哥学Linux,咳!咳!咳!开个玩笑哈,我是一个IT男,IT界的入门选手,正在学习Linux. 在之前,一直想进军IT界,学习IT技术,但是苦于没有人指导,也不知道学什么,最开始我自己在网上 ...
- 3分钟学会做智能插座(DIY)
转载请注明:@小五义http://www.cnblogs.com/xiaowuyiQQ群:64770604 感谢博达科技提供的技术支持,博达科技新出了turnip智能插座,通过微信控制,实现了语音控制 ...
- 看think in java 随笔
java的方法是运行期动态绑定上去的,可以根据自己真正实例化的类来判断调用哪个方法,比如子类重写了父类方法,会调用子类方法. 而利用final关键字可以让方法不能重写,就可以在编译期就绑定,这样就可以 ...
- Removing Timezone from XMLGregorianCalendar
1.去掉時間之後的“Z”或者修改時區 package Package0809; import javax.xml.datatype.DatatypeConfigurationException; im ...
- Luogu2839 Middle 主席树、二分答案
题目传送门:https://www.luogu.org/problemnew/show/P2839 题目大意:给出一个长度为$N$的序列与$Q$次询问,每次询问左端点在$[a,b]$,右端点在$[c, ...