4.1如何实现在本地java项目所在路径(java 项目类里面)中创建文件夹存储文件并删除
String path=
Thread.currentThread().getContextClassLoader().getResource("").toString();
path=path.replace('/', '\\'); // 将/换成\
path = path.replace('/', '\\'); // 将/换成\
path = path.replace("file:", ""); //去掉file:
path = path.replace("classes/", ""); //去掉classes\
path = path.replace("WEB-INF/", ""); //去掉WEB-INF\
//文件添加下级临时目录:files
path += "files";
File file = new File(path);
//创建文件夹
if (!file.exists()) {
file.mkdirs();
}
//删除临时目录
File fileee = new File(path);
fileee.delete();