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 阅读(218) 评论(0)  编辑  收藏 所属分类: 片段


只有注册用户登录后才能发表评论。


网站导航: