File.delete() Does Not Delete File In Java

There may be cases when you call the delete() method in Java and your program does not delete the file. A case like this can only mean that the file is still being used provided that the file exists.

Suggestions indicate that you need to close the stream that uses the file. However, if all else fails, a simple hack can be done to fix this problem.

Just call System.gc() and it should do the trick.

Donations appreciated. Every little $ helps. Or click Google +1.

Related Posts Plugin for WordPress, Blogger...

Post a Comment