Here you can find the source of deleteFile(File file)
public static void deleteFile(File file) throws IOException
//package com.java2s; /**/*from w w w . j a va2 s . c o m*/ * Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Eclipse Public License (EPL). * Please see the license.txt included with this distribution for details. * Any modifications to this file must keep this entire header intact. */ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; public class Main { public static void deleteFile(File file) throws IOException { if (!file.exists()) throw new FileNotFoundException(file.getAbsolutePath()); if (!file.delete()) { throw new IOException("Delete operation failed when deleting: " + file); } } }