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());
        }

    }

}

posted @ 2013-06-28 21:36  亂舞春秋  阅读(186)  评论(0编辑  收藏  举报