DANCE WITH JAVA

          開發出高質量的系統

          常用鏈接

          統計

          積分與排名

          好友之家

          最新評論

          getPath

          web service get path : servlet or jsp? .get context()
          cmd app program get path : make a class like this, get path via itself
          ?
          package common;
          import java.net.URL;
          ?

          public class Path {
          ?public static final String CLASS_PATH;
          ?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);
          ??}
          ??CLASS_PATH=classesPath;
          ?}
          }

          posted on 2006-09-20 22:11 dreamstone 閱讀(231) 評論(0)  編輯  收藏 所屬分類: 片段

          主站蜘蛛池模板: 麻阳| 聂拉木县| 西安市| 都江堰市| 华安县| 岳普湖县| 白河县| 乌兰浩特市| 安塞县| 宣化县| 武冈市| 隆尧县| 梨树县| 通渭县| 绥德县| 休宁县| 常山县| 施甸县| 平潭县| 尖扎县| 滁州市| 昭通市| 五寨县| 团风县| 容城县| 溆浦县| 普定县| 墨竹工卡县| 连平县| 太保市| 富裕县| 长汀县| 盈江县| 新竹市| 商洛市| 武定县| 左贡县| 镇坪县| 靖西县| 邵东县| 黑河市|