DANCE WITH JAVA

          開發出高質量的系統

          常用鏈接

          統計

          積分與排名

          好友之家

          最新評論

          java中判斷操作系統

          public class Path {
          ?public static final String CLASS_PATH;
          ?public static final boolean isLinux;
          ?static{
          ??URL resource = Path.class.getResource("Path.class");
          ??String classPath = resource.getPath();
          ??String className = Path.class.getName().replace('.', '/')
          ????+ ".class";
          ??String classesPath = classPath.substring(0, classPath
          ????.indexOf(className));
          ??if(System.getProperty("os.name").toUpperCase().indexOf("WINDOWS")!=-1&&classesPath.startsWith("/")){
          ???classesPath=classesPath.substring(1);
          ???isLinux=false;
          ??}else{
          ???isLinux=true;
          ??}
          ??CLASS_PATH=classesPath;
          ?}
          }
          ?

          posted on 2006-09-20 21:19 dreamstone 閱讀(1395) 評論(0)  編輯  收藏 所屬分類: jdk相關

          主站蜘蛛池模板: 左权县| 正安县| 偃师市| 景德镇市| 海兴县| 英吉沙县| 治县。| 门源| 乌拉特前旗| 遵义县| 岚皋县| 霍城县| 海淀区| 饶河县| 牡丹江市| 建平县| 文安县| 布尔津县| 天峻县| 岫岩| 买车| 青海省| 广河县| 定安县| 岳阳县| 依安县| 宁河县| 天水市| 随州市| 泽州县| 茌平县| 博湖县| 含山县| 海口市| 阿克陶县| 呼玛县| 永嘉县| 当阳市| 南雄市| 平凉市| 宜兰市|