Here you can find the source of delete(File path)
public static void delete(File path)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void delete(File path) { if (!path.delete()) throw new RuntimeException("Could not delete " + path.getAbsolutePath()); }//w ww. j a va 2 s . c o m }