public static void forceDeleteOnExit ( File file ) throws IOException { if ( file . isDirectory ( ) ) { deleteDirectoryOnExit ( file ) ; } else { file . deleteOnExit ( ) ; } }
Schedules a file to be deleted when JVM exits . If file is directory delete it and all sub - directories .