Here you can find the source of safelyDeleteFile(String filePath)
public static void safelyDeleteFile(String filePath)
//package com.java2s; import java.io.File; public class Main { public static void safelyDeleteFile(String filePath) { safelyDeleteFile(new File(filePath)); }/*w w w. java 2s. c o m*/ public static void safelyDeleteFile(File filePath) { if (filePath != null && filePath.exists()) { filePath.delete(); } } }