I created a file from my java programming, and I am logging some data using the Apache Commons registration API, in particular the Log4j implementation.
After the registration is complete, I set the link to the log class as null. When I now try to delete the file I was writing to, File.delete () returns false.
Deleting a file from Windows Explorer during debugging (at the moment immediately before calling File.delete ()), I get a notification “cannot delete: used by another program”.
There are no open file dependencies from my code (all threads are closed). The only object that can access the file is the log object, which I set to null before calling File.delete ()
Is there anyway that I can see which specific object holds the link to the file resource? Is there any other way to get a log object to free a resource by distinguishing it from zero? Can I force delete a file?
source
share