I\'m creating temporary file in java but i\'m unable to delete it. This is the code I have written:
temp = File.createTempFile(\"temp\", \".txt\"); temp.dele
You have to shut down a VM cleanly in order for the deleteOnExit to work properly (I suspect). On UNIX a kill would be a clean shutdown (i.e. the ShutdownHooks would be processed) whereas a kill -9 would be more like a force quit.
deleteOnExit
UNIX
kill
ShutdownHooks
kill -9
deleteOnExit definitely works for me!