Java Path Delete nio deleteFile(Path p)

Here you can find the source of deleteFile(Path p)

Description

delete File

License

Open Source License

Declaration

public static void deleteFile(Path p) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static void deleteFile(Path p) {
        try {/*from ww w. j ava2s  .c om*/
            Files.deleteIfExists(p);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. delete(String targetFilePath)
  2. deleteAllFilesRecursively(Path path)
  3. deleteContent(Path directory)
  4. deleteEmptyDirsUpTo(Path from, Path to)
  5. deleteEmptyParentDirs(Path pkgDirPath, Path repoPath)
  6. deleteFile(Path path)
  7. deleteFile(Path path)
  8. deleteFile(Path path)
  9. deleteFile(String filePath)