Unable to delete a properties file

前端 未结 2 430
轻奢々
轻奢々 2021-01-21 09:04

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\")         


        
2条回答
  •  逝去的感伤
    2021-01-21 09:25

    There are a couple of reasons why File.delete() can fail:

    • It's a directory and not empty
    • You don't have the OS permission to delete the file
    • The file is still opened somewhere

    The last one could be your own fault, if you've opened a FileInput/OutputStream for that file and forgot to close it.

提交回复
热议问题