使用System.getProperty方法,读取配置JVM系统属性

转载:https://www.cnblogs.com/acm-bingzi/p/6673823.html

使用System.getenv()方法,读取系统变量

            System.out.println("==============================");
        Map envMap = System.getenv();
        Iterator it = envMap.entrySet().iterator();
        while(it.hasNext()) {
            Entry entry = (Entry) it.next();
            System.out.print(entry.getKey()+"="); 
              System.out.println(entry.getValue()); 

        }

        System.out.println("==============================");

        System.out.println(System.getenv("env_test")); // export env_test=test

为什么Java使用System.getenv()获取刚刚设置的环境变量时为空:要在设置变量后的shell里启动eclipse
https://www.cnblogs.com/EasonJim/p/7610949.html