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 { /**/* w w w .j a va2 s .c o m*/ * Deletes the specified file, throwing a {@link RuntimeException} if the * delete fails. */ public static void delete(File file) { if (!file.delete()) { throw new RuntimeException("File " + file.getAbsolutePath() + " can't be deleted."); } } }