I have a file in java that I want to delete but I can't. Here is my code.
public static File fileSave1 = new File("saves/save1.txt");
fileSave1.delete();
System.out.println("File Deleted.");
Main.wait(2000);
As you can see I have tried to use .delete but it doesn't work. I have done research and this is the only way I have seen to delete a file. I believe if I change the file type by removing static it may work but then it would break all of my methods. Any help is appreciated, thanks!
if (fileSave1.exists()) returns true