I have a case, where i need to do System.exit(0); and then immediately restart the same application on kernel panic or something like that. But if i call System.exit(0) first how do i call the exec() ? Like in linux i got it working with BASH.
#!/bin/bash
pkill java;
sleep 1;
java -cp /var/tmp/dist/Kernel.jar main.Kernel
Main.java:
/* Windows platform running */
public class Main {
public static void main(String[] args)
{
// other activity happening.... for ages
//
// Suddently there will be a kernel panic it is better to do a software reboot
// remotely
//
}
public static rebootSoftwareKernel()
{
System.exit(0); // Exit completely
Runtime.getRuntime().exec( MyConstant.RunItSelfSoftReboot() ); // Restart this same
}
}
Look into Tanuki Service Wrapper. Among other features it allows to restart the JVM when needed.