I create a directory in a Java file and delete it when done.
If I quit during Java work, of course it will not perform the deletion.
I've used addShutdownHook() but it seems to work fine with a shutdown command.
My forced shutdown means when i closing the running batch file window. (:when push X button)
Is there a way to solve it in Java source?
It is my tried source
.
.
.
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
// TODO Auto-generated method stub
FileUtils.deleteQuietly(new File(basePath));
}
});
.
.
.