Here you can find the source of delete(File file)
public static boolean delete(File file)
//package com.java2s; //License from project: Apache License import java.io.*; import java.nio.file.*; public class Main { public static boolean delete(File file) { return delete(file.toPath()); }//from w w w. ja v a 2s . c om public static boolean delete(String path) { Path p = Paths.get(path); return delete(p); } public static boolean delete(Path path) { try { return Files.deleteIfExists(path); } catch (IOException e) { e.printStackTrace(); return false; } } }