Perform a reboot from Java Application

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");
            consoleProcess.waitPrompt();
        } catch (Exception ex) {
            throw new IOException("Error rebooting").initCause(ex);
        }
By | Updated On November 3, 2023 2:40 pm | No Comments | Categories: , | Tags: ,


INTEG Process Group, inc. © 2023

Real-Time
Mon - Fri, 8am - 4pm EST
P: 724-933-9350
PureChat
Always Available
Contact Form
sales@integpg.com
support@integpg.com

@integpg
@jniordev
1968