Java代码获取所有系统环境变量


import java.util.Map;

//显示所有操作系统 环境变量
public class EnvironmentVariables {
    public static void main(String[] args) {
        for(Map.Entry entry : System.getenv().entrySet()){//System.getenv()返回一个map类型
            System.out.println(entry.getKey()+"  :  "+entry.getValue());
        }

    }

}

原文地址:https://www.cnblogs.com/lichone2010/p/3161731.html