import java.io.*;
public class DeleteFile {
public static void main(String[] args) {
File newfile = new File("c:\\test.txt");
newfile.delete();
}
you can change the file paths as you want .
you can do more experiments with a NB IDE.