code: public static boolean deleteFile(File file) throws IOException {
  		if (file.isDirectory()) {
  			throw new IOException("File " + file + " isn't a file.");
  		}
  		if (!file.delete()) {
  			if (System.getProperty("os.name").equalsIgnoreCase("windows")) {
  				file = file.getCanonicalFile();
  				System.gc();
  			}
  			try {
  				Thread.sleep(10);
  				return file.delete();
  			} catch (InterruptedException ex) {
  				return file.delete();
  			}
  		}
  		return true;
  	}
docs: Accommodate Windows bug: If the delete does not work, call
  <code>System.gc()</code>, wait a little and try again.