Hai I have developed a standalone application in which when an user logs in, an log file will be created and when the application is closed the log file gets deleted.But when i shutdown the system with out closing the application the log file is not geting deleted.what can i do to delete my log file during shutdown or system crash that is when power supply is switched off when my application is running.Can someone help me to delete the log file during shutdown
Thanking you
Chaithu
If the VM is not properly shutdown it may not start the registered shutdown hooks. So in addition to
File.deleteOnExit()(which I assume you are using, you’re not giving enough details) you should maybe also think about simply deleting all files you created in earlier invocations of your application when your application starts up.