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 閱讀(1392) 評論(0)  編輯  收藏 所屬分類: jdk相關

          主站蜘蛛池模板: 靖远县| 浑源县| 上栗县| 罗源县| 商南县| 彰武县| 浦东新区| 建阳市| 鹤山市| 武鸣县| 确山县| 依兰县| 特克斯县| 佛冈县| 高台县| 周口市| 大荔县| 开化县| 南木林县| 金川县| 葵青区| 太和县| 从江县| 淮北市| 通江县| 铁岭市| 金山区| 宁化县| 凌源市| 泰来县| 台安县| 友谊县| 东城区| 新河县| 清涧县| 进贤县| 阳曲县| 庆城县| 丹阳市| 大宁县| 山东|