I've made a Java program in Eclipse. I started on Windows XP, but have recently upgraded.
As part of it's saving mechanism, the program writes the settings to a file settings_new.sav
. If that goes ok, it deletes the settings.sav
, and renames the new one to match the old name. While it worked under winXP (at least I thought it did, but I can't check now), under win7, it fails to delete the file, even though it was the program that created it (although, a different instance of the program).
The file is picked up by Eclipse and can be deleted from there quite happily. I can delete it manually. I am the admin on my own computer. The folder is just inside the workspace folder, and is not in Program Files (though, I have no idea if eventual users will install it there). The program can create and modify files just fine. It's not throwing any Exception, which I thought it would if it was win7 blocking it.
Any ideas?
It is due to file-locking mechanism in java.Make sure you close the buffering streams such as BufferedReader, BufferedInputStream on that file when done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With