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)  編輯  收藏 所屬分類: 片段

          主站蜘蛛池模板: 洪洞县| 郑州市| 德江县| 溧水县| 深泽县| 德昌县| 长海县| 连云港市| 伊吾县| 郸城县| 自治县| 德昌县| 隆昌县| 金门县| 大田县| 义乌市| 嘉善县| 桐乡市| 大化| 托克逊县| 沂水县| 正镶白旗| 华池县| 登封市| 民丰县| 万安县| 宜兰县| 巨野县| 墨玉县| 曲阳县| 鹿邑县| 桐梓县| 和政县| 陵川县| 灵石县| 广宗县| 桐乡市| 拜泉县| 九台市| 武清区| 平陆县|