java各种情况下读取文件时的路径问题
jar包中:
this.getClass().getResource("/").getPath();// war包://WEB-INF/classes目录this.getClass().getResource("AnyClassOrFile").getPath();// 程序中任意类或文件的路径servlet访问方式不赘。
?
工程中:
不赘述。
?
更详细的可见下列文章:
?
http://zhidao.baidu.com/question/340516870.html?seed=0
http://daniel-tu.iteye.com/blog/433414