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相關

          主站蜘蛛池模板: 金门县| 遂溪县| 宜州市| 达尔| 平武县| 木兰县| 调兵山市| 商城县| 宜昌市| 绩溪县| 慈溪市| 勐海县| 五华县| 瓦房店市| 石楼县| 揭东县| 吉水县| 文安县| 元阳县| 清丰县| 潼关县| 绩溪县| 麻江县| 宝应县| 察雅县| 多伦县| 汝南县| 西昌市| 方山县| 长泰县| 水城县| 清原| 习水县| 万山特区| 隆安县| 信丰县| 宿迁市| 昌图县| 屯门区| 平凉市| 栾城县|