Package org.daisy.dotify.devtools.jvm
Class ProcessStarter
- java.lang.Object
-
- org.daisy.dotify.devtools.jvm.ProcessStarter
-
public class ProcessStarter extends Object
Provides an easy way to start separate JVM instances.
-
-
Constructor Summary
Constructors Constructor Description ProcessStarter()ProcessStarter(OutputStream os)ProcessStarter(PrintStream ps)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String[]buildJavaCommand(String... args)Returns the supplied arguments with the path to java added as the first argumentstatic StringgetJavaPath()intstartProcess(String... command)Starts a process synchronously with the supplied command.
-
-
-
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-problemInterruptedException- if the process is interrupted
-
-