本文介绍了Java File.exists()即使文件不存在也返回true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
String filePath = "C:\Users\d654227/Desktop/abdc.url"; // Actually its getting constructed dynamically.
File file = new File(filePath);
if(file.exists()){
LogUtil.logConsole(filePath+" File already exist.");
file.delete();
}else
{
LogUtil.logConsole(filePath+" File doesnt exist.");
}
使用Windows 7 n IE 9.它是通过applet执行的.相同的代码在我们的开发环境中以及除一位客户之外的大多数客户位置中都有效.
Using Windows 7 n IE 9. Its is getting executed through an applet. Same code works in our dev enviroinment and most of the customer places except one customer.
推荐答案尝试使用所有'/'编写路径.而且注意的是String不是Sting.
Try writing your path with all '/'. And notice is String not Sting.
更多推荐
Java File.exists()即使文件不存在也返回true
发布评论