Class JavaLauncher
java.lang.Object
com.ibm.wala.util.processes.Launcher
com.ibm.wala.util.processes.JavaLauncher
A Java process launcher
-
Nested Class Summary
Nested classes/interfaces inherited from class Launcher
Launcher.DrainerModifier and TypeClassDescriptionprotected classA thread that runs in a loop, performing the drain() action until a process terminates -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidstatic String@Nullable Processbooleanvoidjoin()Wait for the spawned process to terminate.static JavaLaunchermake(String programArgs, String mainClass, boolean inheritClasspath, List<String> classpathEntries, boolean captureOutput, boolean captureErr, Logger logger) static JavaLauncherCompute the classpath for the spawned processstatic StringDeprecated.voidsetEnableAssertions(boolean enableAssertions) voidsetJavaExe(String javaExe) voidstart()Launch the java process.toString()Methods inherited from class Launcher
captureStdErr, captureStdOut, drainStdErr, drainStdOut, getEnv, getInput, getStderr, getStdOut, getWorkingDir, isCaptureErr, isCaptureOutput, setEnv, setInput, setStdErr, setStdOut, setWorkingDir, spawnProcess, spawnProcessModifier and TypeMethodDescriptionprotected Launcher.Drainerprotected Launcher.Drainerprotected Threadprotected ThreadgetEnv()@Nullable byte[]getInput()@Nullable byte[]@Nullable byte[]@Nullable FilebooleanbooleanvoidvoidsetInput(byte[] input) Set input which will be fed to the launched process's stdinprotected voidsetStdErr(byte[] newErr) protected voidsetStdOut(byte[] newOutput) voidsetWorkingDir(File newWorkingDir) protected ProcessspawnProcess(@Nullable String cmd) Spawn a process to execute the given commandprotected ProcessspawnProcess(String[] cmd) Spawn a process to execute the given command
-
Method Details
-
make
public static JavaLauncher make(String programArgs, String mainClass, List<String> classpathEntries, Logger logger) - Parameters:
programArgs- arguments to be passed to the Java programmainClass- Declaring class of the main() method to run.classpathEntries- Paths that will be added to the default classpath
-
make
public static JavaLauncher make(String programArgs, String mainClass, boolean inheritClasspath, List<String> classpathEntries, boolean captureOutput, boolean captureErr, Logger logger) - Parameters:
programArgs- arguments to be passed to the Java programmainClass- Declaring class of the main() method to run.inheritClasspath- Should the spawned process inherit all classpath entries of the currently running process?classpathEntries- Paths that will be added to the default classpathcaptureOutput- should the launcher capture the stdout from the subprocess?captureErr- should the launcher capture the stderr from the subprocess?
-
getJavaExe
-
setJavaExe
-
setProgramArgs
-
getProgramArgs
-
getMainClass
-
getXtraClassPath
-
toString
-
defaultJavaExe
- Returns:
- the string that identifies the java executable file
-
start
Launch the java process.- Throws:
IllegalArgumentExceptionIOException
-
getLastProcess
-
join
public void join()Wait for the spawned process to terminate.- Throws:
IllegalStateException- if the process has not been started
-
makeClasspath
Compute the classpath for the spawned process -
quoteStringIfNeeded
Deprecated.If the input string contains a space, quote it (for use as a classpath). TODO: Figure out how to make a Mac happy with quotes. Trailing separators are unsafe, so we have to escape the last backslash (if present and unescaped), so it doesn't escape the closing quote. -
isEnableAssertions
public boolean isEnableAssertions() -
setEnableAssertions
public void setEnableAssertions(boolean enableAssertions) -
addVmArg
-
getVmArgs
-