Here you can find the source of removeFile(String path)
public static boolean removeFile(String path)
//package com.java2s; //License from project: Apache License import java.io.File; import java.nio.file.*; public class Main { public static boolean removeFile(String path) { File fileToRemove = loadFile(path); return fileToRemove.delete(); }//from www. j av a 2 s.c om public static File loadFile(String path) { if (path == null) { path = "/"; } File f = new File(path); if (f.exists()) { return f.getAbsoluteFile(); } if (!path.startsWith("/")) { path = "/" + path; } return new File(Paths.get("").toAbsolutePath().toString() + path.trim()); } }