Java File Delete delete(File file)

Here you can find the source of delete(File file)

Description

Deletes the specified file, throwing a RuntimeException if the delete fails.

License

Apache License

Declaration

public static void delete(File file) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {
    /**/* w  w  w .j a  va2  s  .c o  m*/
     * Deletes the specified file, throwing a {@link RuntimeException} if the
     * delete fails.
     */
    public static void delete(File file) {
        if (!file.delete()) {
            throw new RuntimeException("File " + file.getAbsolutePath()
                    + " can't be deleted.");
        }
    }
}

Related

  1. delete(File file)
  2. delete(File file)
  3. delete(File file)
  4. delete(File file)
  5. delete(File file)
  6. delete(File file)
  7. delete(File file)
  8. delete(File file)
  9. delete(File file)