Here you can find the source of delete(String filePath, String fileName)
public static void delete(String filePath, String fileName) throws Exception
//package com.java2s; import java.io.File; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void delete(String filePath, String fileName) throws Exception { Path fileToDeletePath = Paths.get(filePath + File.separator + fileName); boolean existsFile = fileToDeletePath.toFile().exists(); if (existsFile) { Files.delete(fileToDeletePath); }// ww w . j a v a 2 s.co m } }