You can delete file in java by following method:
1. Create a File Object to your file, example:
File myTempFile = new File("C:/temp/sample.txt");
// Check if it is a file, i.e, no directory and file exist
if( myTempFile.isFile() && myTempFile.exists() ) {
// Then delete file
myTempFile.delete();
}
Dont forget to import java.io.* at the top.