Here you can find the source of delete(File file)
public static void delete(File file)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static void delete(String path) { if (null == path || (path = path.trim()).isEmpty()) throw new IllegalArgumentException("Illegal 'path' argument in Utils.delete(String): " + path); delete(new File(path)); }/*from w w w . j av a2 s . co m*/ public static void delete(File file) { if (null == file) throw new IllegalArgumentException("Illegal 'file' argument in Utils.delete(File): " + file); if (file.exists()) { if (file.isDirectory()) { for (File child : file.listFiles()) { delete(child); } } file.delete(); } } }