当前位置: 代码迷 >> J2EE >> 这个返回系统绝对根路径的方法哪位高手跟小弟我详细讲下
  详细解决方案

这个返回系统绝对根路径的方法哪位高手跟小弟我详细讲下

热度:33   发布时间:2016-04-21 22:25:16.0
这个返回系统绝对根路径的方法谁跟我详细讲下
public static final String getRootPath() {
String path = Constants.class.getResource("/").toString();
return path.substring(6, path.length()).replace("%20", " ");
}

这里两句时什么意思啊,还有%20

------解决方案--------------------
获取class所在文件路径,截取硬盘路径,%20是空格的显示,所以要还原。
  相关解决方案