public static boolean delete(File file){
  if (file == null) {
    return false;
  }
  try {
    return file.delete();
  }
 catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
}

public static boolean delete ( File file ) { if ( file == null ) { return false ; } try { return file . delete ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return false ; } }
delete a file ignoring exceptions .
