Here you can find the source of delete(String targetFilePath)
public static void delete(String targetFilePath) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void delete(String targetFilePath) throws IOException { Path path = Paths.get(targetFilePath); Files.deleteIfExists(path); }//from w w w .j av a 2s . co m }