java 动态获取web应用的部署路径

来源:互联网 发布:淘宝无法付款 系统异常 编辑:程序博客网 时间:2024/06/01 07:40
public static String DEPLOY_PATH = null;static{String CurrentClassFilePath = Constant.class.getResource("").getPath();int lastpath = CurrentClassFilePath.lastIndexOf("WEB-INF/");DEPLOY_PATH = CurrentClassFilePath.substring(0, lastpath);}


参考:http://blog.sina.com.cn/s/blog_6f3da9650101d70r.html

http://tech.ddvip.com/2011-11/1322014194170006.html

0 0
原创粉丝点击