Here you can find the source of delete(File file)
public static void delete(File file)
//package com.java2s; /*//from www . jav a 2s. c o m * Copyright (c) 2004, simontsui, Chris Leung. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html. */ import java.io.File; public class Main { /** Do File.delete(), ignoring failure. */ public static void delete(File file) { if (file.exists() && !file.delete()) { // ignore return; } } /** Do File.delete(), ignoring failure. */ public static void delete(File... files) { for (File file : files) { if (file.exists() && !file.delete()) { // ignore return; } } } }