bestlong 怕失憶論壇

 

 

搜索
bestlong 怕失憶論壇 論壇 Java 用 Java 取得所有系統變數
查看: 3692|回復: 0
go

用 Java 取得所有系統變數 [複製鏈接]

Rank: 9Rank: 9Rank: 9

1#
發表於 2010-12-25 11:25 |只看該作者 |倒序瀏覽 |打印
  1. import java.util.*;
  2. import java.util.Map.*;

  3. public class ShowSysVar {
  4.        
  5.         public static void getSysProp() {
  6.                 Properties props = System.getProperties();
  7.                 Set<Entry<Object,Object>> res = props.entrySet();
  8.                 Iterator it = res.iterator();
  9.                 while (it.hasNext()) {
  10.                         Map.Entry e = (Map.Entry)it.next();
  11.                         System.out.println(e.getKey() + "=" + e.getValue());
  12.                 }
  13.         }
  14.        
  15.         public static void main(String args[]) {
  16.                 getSysProp();
  17.         }
  18. }
複製代碼
我是雪龍
http://blog.bestlong.idv.tw
http://www.bestlong.idv.tw
‹ 上一主題|下一主題

Archiver|怕失憶論壇

GMT+8, 2024-4-20 06:09 , Processed in 0.032372 second(s), 10 queries .

Powered by Discuz! X1.5

© 2001-2010 Comsenz Inc.