获取tomcat下java项目根目录路径

来源:互联网 发布:linux操作系统有什么用 编辑:程序博客网 时间:2024/05/17 09:38
String nodepath = this.getClass().getClassLoader().getResource("/").getPath();// 项目的根目录路径String filePath = nodepath.substring(1, nodepath.length() - 16);
注意:这里每个文件夹中的名字不能有空格,不然会报错
1 0
原创粉丝点击