Here you can find the source of deleteTempFile(File f)
public static boolean deleteTempFile(File f)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { private static List<String> tempFiles = Collections.synchronizedList(new ArrayList<String>()); public static boolean deleteTempFile(File f) { if (f == null) { return false; }// w w w.ja va 2 s . co m f.deleteOnExit(); f.delete(); if (f.exists()) { return false; } else { try { tempFiles.remove(f.getCanonicalPath()); } catch (IOException ioe) { tempFiles.remove(f.getAbsolutePath()); } return true; } } }