Here you can find the source of deleteFile(String filePath)
public static void deleteFile(String filePath)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void deleteFile(String filePath) { if (null == filePath || "".equals(filePath.trim())) { throw new IllegalArgumentException("File Path cannot be Null/Empty"); }/*ww w .ja v a 2 s . co m*/ deleteFile(new File(filePath)); } public static void deleteFile(File file) { if (null == file || !file.exists()) { throw new IllegalArgumentException(file + " does not exist"); } file.delete(); } }