Here you can find the source of deleteFile(String path, String filename)
public static boolean deleteFile(String path, String filename) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static boolean deleteFile(String path, String filename) throws IOException { File dir = new File(path); if (!dir.exists()) throw new FileNotFoundException("Directory " + path + " doesn't exist."); File serverFile = new File(dir.getAbsolutePath() + File.separator + filename); boolean result = serverFile.delete(); return result; }//from w w w .j av a 2s . com }