Here you can find the source of forceDelete(final File file)
public static void forceDelete(final File file)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static void forceDelete(final File file) { if (file.exists()) { if (file.isDirectory()) { for (final File f : file.listFiles()) { forceDelete(f);//ww w. j a v a 2 s. c om } } try { if (!file.delete()) { file.deleteOnExit(); } } catch (final Exception e) { } } } }