无法删除属性文件 [英] Unable to delete a properties file
本文介绍了无法删除属性文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须从指定的路径中删除属性文件。我使用了以下代码:
I have to delete a property file from the path specified. I used the following code:
File f1 = new File("C:\\Equinox\\UIDesign\\root\\root.properties");
boolean success=f1.delete();
返回false。
但是成功删除了文本文件而不是属性文件。
But a text file instead of property file is succesfully deleted.
推荐答案
文件有几个原因。 delete()
可能会失败:
- 这是一个目录而非空
- 您没有删除文件的操作系统权限
- 文件仍在某处打开
最后一个可能是你自己的错,如果你为该文件打开了一个FileInput / OutputStream并忘了关闭它。
The last one could be your own fault, if you've opened a FileInput/OutputStream for that file and forgot to close it.
这篇关于无法删除属性文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文