zoukankan      html  css  js  c++  java
  • 获取系统属性值

    public static void main(String[] args) {

        Properties properties = System.getProperties();
        Set<String> keys = properties.stringPropertyNames();
        Object[] objects = keys.toArray();
        for (int i = 0; i <objects.length ; i++) {
    
            String key=(String) objects[i];
            String value = properties.getProperty(key);
            System.out.println(key+"===="+value);
    
    
        }
        String javaHome = properties.getProperty("java.home");
        System.out.println("java_home目录是  "+javaHome);
    
        String osName = properties.getProperty("os.name");
        String osVersion = properties.getProperty("os.version");
        System.out.println("系统版本:"+osName+" "+osVersion+" 版 ");
    
    
    
    public static void main(String[] args) {
    
        Properties properties = System.getProperties();
        Set<String> keys = properties.stringPropertyNames();
    
        for(String key:keys){
            String value = properties.getProperty(key);
            System.out.println(key+"--------="+value);
    
        }
        String javaHome = properties.getProperty("java.home");
        System.out.println("java_home目录是  "+javaHome);
    
        String osname = properties.getProperty("os.name");
        String osVer = properties.getProperty("os.version");
        System.out.println("系统版本:"+osname+" "+osVer+" 版 ");
    
    
    }
  • 相关阅读:
    shell基础之更改IP
    shell基础之if语句
    shell基础之变量及表达式
    shell基础之shell相关概念
    shell基础之bus实战(if 练习)
    shell基础之pxe批量部署
    shell基础之编译安装nginx
    Razor视图引擎基础语法
    EF三层
    EF简单增删改查
  • 原文地址:https://www.cnblogs.com/ITniu/p/11099245.html
Copyright © 2011-2022 走看看