jsp 用File 类 删除指定路径的文件 下面的代码怎么改进才能实现???
Stringaddr=request.getRemoteAddr();Stringpath="http://"+addr+":8080/test/x.jpg";Syste...
String addr = request.getRemoteAddr();
String path = "http://" + addr + ":8080/test/x.jpg";
System.out.println("path:" + path);
java.io.File f = new java.io.File(path);
if (f.exists()) {
System.out.println("file exists...");
f.delete();
} else
System.out.println("file not exists..."); 展开
String path = "http://" + addr + ":8080/test/x.jpg";
System.out.println("path:" + path);
java.io.File f = new java.io.File(path);
if (f.exists()) {
System.out.println("file exists...");
f.delete();
} else
System.out.println("file not exists..."); 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询