Here you can find the source of deleteFile(String path)
public static void deleteFile(String path)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void deleteFile(String path) { try {/*from w w w .ja v a 2s . c o m*/ File file = new File(path); if (file.delete()) { System.out.println(file.getName() + " is deleted!"); } else { System.out.println("Delete operation is failed."); } } catch (Exception e) { e.printStackTrace(); } } }