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

          主站蜘蛛池模板: 宁强县| 若尔盖县| 靖远县| 长乐市| 安阳县| 图们市| 深州市| 西吉县| 西盟| 贵溪市| 佛坪县| 贵德县| 平泉县| 托克托县| 铜梁县| 元阳县| 祁东县| 喀什市| 武隆县| 万盛区| 海安县| 临西县| 朝阳区| 横山县| 平潭县| 肃北| 景洪市| 九龙坡区| 东乡县| 莫力| 博兴县| 大连市| 阆中市| 镶黄旗| 沂源县| 罗平县| 灵寿县| 周宁县| 宣恩县| 岑巩县| 英吉沙县|