> for example I used something like this:
> MultiPPC1.main(args);
>
> to start again but I didn't close the previous
> application
Read what I said. You need to terminate the application, by e.g. executing System.exit(1), and then restart from a script.
Kaj
OK!
have a look to my code:
if( e.getActionCommand().equals( "exit" ) )
System.exit( 0 );
else if( e.getActionCommand().equals( "restart" ) )
{
System.exit(1);
String[] args = new String[0];
try {
MultiPPC1.main(args);
} catch (IOException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
> Actualy I don't know. but you understand that what I
> want.
Yes
> can you help me?
A start script is a file that launches your application, e.g. a bat-file, a cmd-file or a linux/unix-script. You need to write a script with a loop which checks the exit code and executes the app again if needed. That is not Java releated and platform dependent, so please google.
Kaj
A start script is overkill, especially if this is just a user application that might just be run once and quit, not to mention that platform dependence of it. If that's what you're considering, I would recommend doing something likeRunTime.getRuntime().exec("java My_Program");
System.exit(1);
instead, which would start a whole new JVM running your program, and then kill the original. Not exactly pretty or efficient, but it would restart it.