I am working on a Swing app. In my app I am writing some data to the text files. I want to clear these text files (erase all data in it) in one operation when I again run this app. But I guess I am not able to do so since, these files get open in an read only mode when I run the app next time.
I am currently using following code clear files. Its basically deleting and again creating file with the same name.
File sFile = new File("logCases.txt");
File sFile_New = new File("logCases.txt");
but no new file is getting created
.. is there any other work around for this (to erase data in file)? I guess instead of deleting erasing would be a better option.