Here you can find the source of fileDelete(String path)
public static int fileDelete(String path)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static int fileDelete(String path) { File file = new File(path); if (!file.exists() || file.isDirectory()) return 4; if (file.delete()) { return 0; }/*from w w w. ja v a 2 s . co m*/ return 1; } }