java file.delete() returns false but file.exists() returns true

后端 未结 7 1527
心在旅途
心在旅途 2020-12-06 09:47

When I am trying to delete a file which is present in tomcat server conf/Catalina/localhost from java code then file.delete() always returns false. But if I am checking the

7条回答
  •  温柔的废话
    2020-12-06 10:28

    It means that file is existing, but your java process dont have the permission to delete that.That is why delete function is returning false

    Returns: true if and only if the file or directory is successfully deleted; false otherwise

提交回复
热议问题