java 文件获得项目的路径

URL url = this.getClass().getResource("");

try{

  //需要根据实际情况写http://www.cnblogs.com/

  String path = new File(url.getPath(),"http://www.cnblogs.com/").getCanonicalPath();

}catch(Exception e){

}

 

posted @ 2013-05-10 00:36  NewObject_1  阅读(158)  评论(0编辑  收藏  举报