Java Path Remove nio removeFile(final String removePath)

Here you can find the source of removeFile(final String removePath)

Description

remove File

License

Apache License

Declaration

protected static void removeFile(final String removePath) 

Method Source Code

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

import java.io.IOException;
import java.nio.file.*;

public class Main {
    protected static void removeFile(final String removePath) {

        try {//w  w w .java 2  s.com
            final Path path = Paths.get(removePath);

            Files.delete(path);

        } catch (final IOException e) {
            System.err.println("Couldn't delete file. Exception: " + e);
        }
    }
}

Related

  1. removeDirectory(Path directory)
  2. removeDirectory(Path directory)
  3. removeDirectory(String pathToDir)
  4. removeDirectoryIfItIsEmpty(Path directoryToRemove)
  5. removeDriveLetter(Path path)
  6. removeFile(String path)
  7. removeFile(String workspacePath)
  8. removeLine(String path, String line, boolean commentAware)
  9. removeRecursive(Path path)