Java可读取操作系统的配置

 1 /**
 2      * Java获取操作系统的配置环境
 3      * @throws Exception
 4      */
 5     @Test
 6     public void testPro() throws Exception {
 7         Properties properties = System.getProperties();
 8         for(Entry<Object, Object> entry:properties.entrySet()){
 9             System.out.println(entry.getKey()+"============="+entry.getValue());
10         }
11         
12         //获取从根目录到项目名的路径
13         String path = System.getProperty("user.dir");
14         System.out.println(path);
15     }

 

posted @ 2015-12-03 09:10  悬崖边上  阅读(203)  评论(0编辑  收藏  举报