获取项目中文件夹的绝对路径

String classpath = this.getClass().getResource("/").getPath().replaceFirst("/", "");

String fileDir = classpath.replaceAll("WEB-INF/classes/", "upload");

upload为目标文件夹,fileDir 为路径

猜你喜欢

转载自blog.csdn.net/hiqingtian/article/details/79380076