我有一个案例,我需要做System.exit(0);
然后立即在内核恐慌或类似的事情上重启相同的应用程序。但是,如果我首先调用System.exit(0)我如何调用exec()?就像在Linux中一样,我让它与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
}
}