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     }

 

你可能感兴趣的:(Java可读取操作系统的配置)