Java File.exists()即使文件不存在也返回true

编程入门 行业动态 更新时间:2024-10-28 20:25:37
本文介绍了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

本文发布于:2023-06-08 14:27:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/583062.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不存在   文件   File   Java   true

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!