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 閱讀(235) 評論(0)  編輯  收藏 所屬分類: 片段

          主站蜘蛛池模板: 射阳县| 环江| 集安市| 罗平县| 伊金霍洛旗| 宿松县| 民乐县| 临泉县| 麦盖提县| 皮山县| 托克逊县| 阳城县| 盐城市| 墨脱县| 罗定市| 信阳市| 衡东县| 陇西县| 绥德县| 游戏| 台中市| 谷城县| 上饶县| 屏东市| 光山县| 甘德县| 广宁县| 长丰县| 大化| 常熟市| 全州县| 刚察县| 海淀区| 筠连县| 喀什市| 东城区| 扎赉特旗| 华容县| 郸城县| 资溪县| 平湖市|