Here you can find the source of delete(File file)
public static void delete(File file) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void delete(File file) throws Exception { try {//from ww w . j a v a 2 s . c o m file.delete(); } catch (Exception e) { throw new Exception(file.toString() + ": Can't delete"); } } }