Does anyone know how to delete a file?
I have a JTextField which takes a user defined path. After i read the file i want to delete it but for some reason the delete() method doesnt work. I know there is a deleteOnExit() method but i need to have the file deleted during program execution.

File filepath = new File(jtf.getText()); // should have .txt extension
filepath.delete()