Java tutorial
import java.io.IOException; import java.nio.file.Path; import java.nio.file.Files; import java.nio.file.FileSystems; public class Main { public static void main(String[] args) { Path path = FileSystems.getDefault().getPath("C:/tutorial/photos", "Demo.jpg"); //delete the file try { Files.delete(path); } catch (IOException | SecurityException e) { System.err.println(e); } } }