Perform a reboot from Java Application June 17, 2019

When we want to reboot the JNIOR from our Java application we call the command line reboot command.  To call to the command line we use the ConsoleProcess class.  Since there will not be any user to confirm the reboot we need to use the -f command to force the reboot.

        try {
// the -f option forces the reboot without the need for user confirmation
ConsoleProcess consoleProcess = new ConsoleProcess("reboot -f");
} catch (Exception ex) {
throw new IOException("Error rebooting").initCause(ex);
By | On June 17, 2019 10:23 pm | No Comments | Categorized in: , ,