Here you can find the source of deleteFile(String dest)
public static void deleteFile(String dest) throws IOException
//package com.java2s; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; public class Main { private static final String MSG_NOT_FOUND = "Not found: "; private static final String MSG_NOT_A_FILE = "Not a file: "; private static final String MSG_UNABLE_TO_DELETE = "Unable to delete: "; public static void deleteFile(String dest) throws IOException { deleteFile(new File(dest)); }//from w w w .java 2 s . c om public static void deleteFile(File dest) throws IOException { if (!dest.exists()) { throw new FileNotFoundException(MSG_NOT_FOUND + dest); } if (!dest.isFile()) { throw new IOException(MSG_NOT_A_FILE + dest); } if (!dest.delete()) { throw new IOException(MSG_UNABLE_TO_DELETE + dest); } } }