Here you can find the source of deleteFile(Path path)
Parameter | Description |
---|---|
path | - The file path |
public static void deleteFile(Path path)
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.nio.file.DirectoryNotEmptyException; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; public class Main { /**/*from w ww . j a va 2 s. co m*/ * Deletes a file * @param path - The file path */ public static void deleteFile(Path path) { try { Files.delete(path); } catch (NoSuchFileException x) { System.err.format("%s: no such" + " file or directory%n", path); } catch (DirectoryNotEmptyException x) { System.err.format("%s not empty%n", path); } catch (IOException x) { // File permission problems are caught here. System.err.println(x); } } }