| java.lang.Object edu.rice.cs.util.newjvm.ExecJVM
ExecJVM | final public class ExecJVM (Code) | | A utility class to allow executing another JVM.
version: $Id: ExecJVM.java 4255 2007-08-28 19:17:37Z mgricken $ |
Method Summary | |
public static void | printOutput(Process theProc, String msg, String sourceName) Prints the stdout and stderr of the given process, line by line. | public static Process | runJVM(String mainClass, String[] classParams, String[] classPath, String[] jvmParams, File workDir) Runs a new JVM. | public static Process | runJVM(String mainClass, String[] classParams, String classPath, String[] jvmParams, File workDir) Runs a new JVM. | public static Process | runJVMPropagateClassPath(String mainClass, String[] classParams, String[] jvmParams, File workDir) Runs a new JVM, propagating the present classpath. | public static Process | runJVMPropagateClassPath(String mainClass, String[] classParams, File workDir) Runs a new JVM, propagating the present classpath. | public static void | ventBuffers(Process theProc, LinkedList<String> outLines, LinkedList<String> errLines) Empties BufferedReaders by copying lines into LinkedLists. |
printOutput | public static void printOutput(Process theProc, String msg, String sourceName) throws IOException(Code) | | Prints the stdout and stderr of the given process, line by line. Adds a message and tag to identify the source
of the output. Note that this code will print all available stdout before all stderr, since it is impossible
to determine in which order lines were added to the respective buffers.
Parameters: theProc - a Process object whose output will be handled Parameters: msg - an initial message to print before output Parameters: sourceName - a short string to identify the process throws: IOException - if there is a problem with the streams |
runJVM | public static Process runJVM(String mainClass, String[] classParams, String[] classPath, String[] jvmParams, File workDir) throws IOException(Code) | | Runs a new JVM.
Parameters: mainClass - Class to run Parameters: classParams - Parameters to pass to the main class Parameters: classPath - Array of items to put in classpath of new JVM Parameters: jvmParams - Array of additional command-line parameters to pass to JVM Process object corresponding to the executed JVM |
runJVM | public static Process runJVM(String mainClass, String[] classParams, String classPath, String[] jvmParams, File workDir) throws IOException(Code) | | Runs a new JVM.
Parameters: mainClass - Class to run Parameters: classParams - Parameters to pass to the main class Parameters: classPath - Pre-formatted classpath parameter Parameters: jvmParams - Array of additional command-line parameters to pass to JVM Process object corresponding to the executed JVM |
runJVMPropagateClassPath | public static Process runJVMPropagateClassPath(String mainClass, String[] classParams, String[] jvmParams, File workDir) throws IOException(Code) | | Runs a new JVM, propagating the present classpath. It changes the entries in the class path to absolute form.
Parameters: mainClass - Class to run Parameters: classParams - Parameters to pass to the main class Parameters: jvmParams - Array of additional command-line parameters to pass to JVM Process object corresponding to the executed JVM |
runJVMPropagateClassPath | public static Process runJVMPropagateClassPath(String mainClass, String[] classParams, File workDir) throws IOException(Code) | | Runs a new JVM, propagating the present classpath.
Parameters: mainClass - Class to run Parameters: classParams - Parameters to pass to the main class Process object corresponding to the new JVM process |
ventBuffers | public static void ventBuffers(Process theProc, LinkedList<String> outLines, LinkedList<String> errLines) throws IOException(Code) | | Empties BufferedReaders by copying lines into LinkedLists.
This is intended for use with the output streams from an ExecJVM process.
Source and destination objects are specified for stdout and for stderr.
Parameters: theProc - a Process object whose output will be handled Parameters: outLines - the LinkedList of Strings to be filled with the lines read from outBuf Parameters: errLines - the LinkedList of Strings to be filled with the lines read from errBuf |
|
|