As Tim Bender notes, he File.deleteOnExit()does not guarantee that the file will be deleted.
Unixish (, Linux OSX), , ( ). , , , , , , ( ).
Windows, . , , deleteOnExit():
File tempFile = File.createTempFile("tempfile", ".tmp");
RandomAccessFile fh = new RandomAccessFile (tempFile, "rw");
// try to delete the file now, fall back to deletion on exit
if ( !tempFile.delete() ) tempFile.deleteOnExit();
, , -, File.deleteOnExit() Windows. , , , . . , .