Class ProcessStarter


  • public class ProcessStarter
    extends Object
    Provides an easy way to start separate JVM instances.
    • Constructor Detail

      • ProcessStarter

        public ProcessStarter()
      • ProcessStarter

        public ProcessStarter​(OutputStream os)
      • ProcessStarter

        public ProcessStarter​(PrintStream ps)
    • Method Detail

      • getJavaPath

        public static String getJavaPath()
      • buildJavaCommand

        public static String[] buildJavaCommand​(String... args)
        Returns the supplied arguments with the path to java added as the first argument
        Parameters:
        args - the arguments
        Returns:
        returns the command
      • startProcess

        public int startProcess​(String... command)
                         throws IOException,
                                InterruptedException
        Starts a process synchronously with the supplied command.
        Parameters:
        command - the command, e.g. java -jar path/to/jar
        Returns:
        returns the return value of the process
        Throws:
        IOException - if there is an IO-problem
        InterruptedException - if the process is interrupted