1.获取项目classpath目录
String pathName = this.getClass().getResource("/").getPath();
2.获取项目根目录
String rootPath=getClass().getResource("/").getFile().toString();
String path = rootPath.substring(0,rootPath.indexOf("WEB-INF"));
1.获取项目classpath目录
String pathName = this.getClass().getResource("/").getPath();
String rootPath=getClass().getResource("/").getFile().toString();
String path = rootPath.substring(0,rootPath.indexOf("WEB-INF"));