public static void deleteFileOrDir(File file) throws IOException {
	if (file.isDirectory()) {
	    File[] children = file.listFiles();
	    if (children != null) {
		for (File child : children) {
		    deleteFileOrDir(child);
		}
	    }
	}
	if (!file.delete()) {
	    throw new IOException("Could not remove '" + file + "'!");
	}
    }
public static void deleteFileOrDir ( File file ) throws IOException { if ( file . isDirectory ( ) ) { File [ ] children = file . listFiles ( ) ; if ( children != null ) { for ( File child : children ) { deleteFileOrDir ( child ) ; } } } if ( ! file . delete ( ) ) { throw new IOException ( "Could not remove '" + file + "'!" ) ; } }
Utility method used to delete the profile directory when run as a stand-alone
application.

@param file
The file to recursively delete.
@throws IOException
is thrown in case of IO issues.