Here you can find the source of delete(File f)
public static void delete(File f)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static void delete(File f) { if (!f.exists()) throw new IllegalArgumentException("Delete: no such file or directory: " + f.getName()); boolean success = f.delete(); if (!success) throw new IllegalArgumentException("Delete: deletion failed: " + f.getAbsolutePath()); }/*w w w.ja va2 s . c om*/ }