So what I want to do. I have a GUI application-simple game.
In this game I have a button Restart and when a user click it I would like that the application restart itself and start from the begining.
I tried something like this:
when button restart is pressed { //pseudocode
try {
Runtime.getRuntime().exec("java -jar application.jar");
System.exit(0);
} catch (IOException e) {
}
}
This works 50%. What it does. It kills the precedent application and start the same again. But the first problem is that it takes samething like 1-2 seconds to do that. And in this time you can see on the desktop how the application dissaper and reaper.
I would to do that without dissapearint.. just restart the game.
And secondly it works only the first time.. if I want to restart it the second time it just close/exit itself.


Sign In
Create Account


Back to top









