String path = Thread.currentThread().getContextClassLoader().getResource("").getPath()+"/temp";
File file = new File(path);
if (!file.exists()){
file.mkdir();
}
File file1 = new File(path + "/" + "test"+".jpg");
if (!file1.exists()){
try {
boolean newFile = file1.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
// 可采用异步删除
file1.delete();
System.out.println(path);