Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static void delete(String path) { try { if (path == null) { return; } File file = new File(path); if (!file.delete()) { file.deleteOnExit(); } } catch (Exception e) { e.printStackTrace(); } } }