System中可以获取到的property等数据

简介: System中可以获取到的property等数据
public class Test {
    public static void main(String[] args) {
        String javaVersion = System.getProperty("java.version");//Java运行环境版本
        String javaVendor = System.getProperty("java.vendor");//Java运行时环境供应商
        String javaVendorUrl = System.getProperty("java.vendor.url");//Java供应商URL
        String javaHome = System.getProperty("java.home");//Java安装目录
        String javaVmSpecificationVersion = System.getProperty("java.vm.specification.version");//Java虚拟机规范版本
        String javaVmSpecificationVendor = System.getProperty("java.vm.specification.vendor");//Java虚拟机规范供应商
        String javaVmSpecificationName = System.getProperty("java.vm.specification.name");//Java虚拟机规范名称
        String javaVmVersion = System.getProperty("java.vm.version");//Java虚拟机实现版本
        String javaVmVendor = System.getProperty("java.vm.vendor");//Java虚拟机实现供应商
        String javaVmName = System.getProperty("java.vm.name");//Java虚拟机实现名称
        String javaSpecificationVersion = System.getProperty("java.specification.version");//Java运行时环境规范版本
        String javaSpecificationVendor = System.getProperty("java.specification.vendor");//Java运行时环境规范供应商
        String javaSpecificationName = System.getProperty("java.specification.name");//Java运行时环境规范名称
        String javaClassVersion = System.getProperty("java.class.version");//Java类格式版本号
        String javaClassPath = System.getProperty("java.class.path");//Java类路径
        String javaLibraryPath = System.getProperty("java.library.path");//加载库时搜索的路径列表
        String javaIoTmpdir = System.getProperty("java.io.tmpdir");//默认的临时文件路径
        String javaCompiler = System.getProperty("java.compiler");//要使用的JIT编译器的名称
        String javaExtDirs = System.getProperty("java.ext.dirs");//一个或多个扩展目录的路径
        String osName = System.getProperty("os.name");//操作系统名称
        String osArch = System.getProperty("os.arch");//操作系统的架构
        String osVersion = System.getProperty("os.version");//操作系统版本
        String fileSeparator = System.getProperty("file.separator");//文件分隔符(在UNIX系统中是“/”)
        String pathSeparator = System.getProperty("path.separator");//路径分隔符(在UNIX系统中是“:”)
        String lineSeparator = System.getProperty("line.separator");//行分隔符(在UNIX系统中是“/n”)
        String userName = System.getProperty("user.name");//用户的账户名称
        String userHome = System.getProperty("user.home");//用户的主目录
        String userDir = System.getProperty("user.dir");//行分隔符(在UNIX系统中是“/n”)
        System.out.println("javaVersion:::::"+javaVersion);
        System.out.println("javaVendor:::::"+javaVendor);
        System.out.println("javaVendorUrl:::::"+javaVendorUrl);
        System.out.println("javaHome:::::"+javaHome);
        System.out.println("javaVmSpecificationVersion:::::"+javaVmSpecificationVersion);
        System.out.println("javaVmSpecificationVendor:::::"+javaVmSpecificationVendor);
        System.out.println("javaVmSpecificationName:::::"+javaVmSpecificationName);
        System.out.println("javaVmVersion:::::"+javaVmVersion);
        System.out.println("javaVmVendor:::::"+javaVmVendor);
        System.out.println("javaVmName:::::"+javaVmName);
        System.out.println("javaSpecificationVersion:::::"+javaSpecificationVersion);
        System.out.println("javaSpecificationVendor:::::"+javaSpecificationVendor);
        System.out.println("javaSpecificationName:::::"+javaSpecificationName);
        System.out.println("javaClassVersion:::::"+javaClassVersion);
        System.out.println("javaClassPath:::::"+javaClassPath);
        System.out.println("javaLibraryPath:::::"+javaLibraryPath);
        System.out.println("javaIoTmpdir:::::"+javaIoTmpdir);
        System.out.println("javaCompiler:::::"+javaCompiler);
        System.out.println("javaExtDirs:::::"+javaExtDirs);
        System.out.println("osName:::::"+osName);
        System.out.println("osArch:::::"+osArch);
        System.out.println("osVersion:::::"+osVersion);
        System.out.println("fileSeparator:::::"+fileSeparator);
        System.out.println("pathSeparator:::::"+pathSeparator);
        System.out.println("lineSeparator:::::"+lineSeparator);
        System.out.println("userName:::::"+userName);
        System.out.println("userHome:::::"+userHome);
        System.out.println("userDir:::::"+userDir);
    }
}
目录
相关文章
|
C#
C# 一分钟浅谈:条件语句 if-else 的使用
【9月更文挑战第1天】条件语句是编程中的基础概念,C# 中的 `if-else` 语句允许根据不同条件执行不同代码块。本文详细介绍了 `if-else` 语句的基本语法和使用方法,并提供了多个示例,如根据年龄判断是否可以观看电影、根据成绩评定学生等级等。此外,还探讨了常见问题及其解决方法,例如条件表达式错误、忽略边界条件和条件分支过多等问题,并介绍了如何使用括号明确优先级、避免冗余条件、使用 `switch` 语句和提取公共逻辑等技巧。通过本文的学习,你可以更好地理解和运用 C# 中的条件语句。
356 1
|
弹性计算
阿里云ECS使用体验
在申请高校学生免费体验阿里云ECS云服务器后的一些使用体验和感受。
|
敏捷开发 前端开发 架构师
如何做好一个信息系统项目经理,一个项目经理的个人体会和经验总结(二)
如何做好一个信息系统项目经理,一个项目经理的个人体会和经验总结(二)
110 0
|
SQL IDE 前端开发
从0开始开发一个表单引擎(上)
介绍如何通过一张数据库表中字段的相关信息,生成一系列CRUD的api。
1373 1
从0开始开发一个表单引擎(上)
|
对象存储 开发者
《开发者评测》之对象存储OSS获奖名单
对象存储OSS评测活动获奖名单出炉啦!
785 0
|
Go 开发工具 C语言
Golang框架:cobra
这些都是命令,二前面的ls、git、gcc等都是我们写的程序。如果不使用 cobra 框架进行编写这些命令,那么程序写起来是相当费劲的。
220 0
|
Go
go的interface怎么实现的?
面试题:go的interface怎么实现的?
201 0
|
存储 SQL 安全
疯狂Java讲义笔记汇总
目录 • 一、基础类型 • 二、流程控制与数组 • 三、面向对象 • 四、基础类库 • 五、集合 • 六、泛型 • 七、异常 • 八、数据库 • 九、注释 • 十、输入输出 • 十一、网络 • 十二、类加载机制 • 十三、多线程
|
SQL 消息中间件 缓存
12种接口优化的通用方案
12种接口优化的通用方案
300 0