测试只在windows底下,基于Linux没测试..
private String getContextPath(){
String contextPath = this.getClass().getResource("/").toString().replace("/", "\\\\");
contextPath = contextPath.substring(contextPath.indexOf("\\")+2,contextPath.length());
return contextPath;
}
java获取项目物理路径
最新推荐文章于 2021-02-27 05:52:21 发布