Package com.ibm.wala.util.processes
Class JavaLauncher
- java.lang.Object
-
- com.ibm.wala.util.processes.Launcher
-
- com.ibm.wala.util.processes.JavaLauncher
-
public class JavaLauncher extends Launcher
A Java process launcher
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.ibm.wala.util.processes.Launcher
Launcher.Drainer
-
-
Field Summary
-
Fields inherited from class com.ibm.wala.util.processes.Launcher
env, stdErr, stdOut, workingDir
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddVmArg(String arg)static StringdefaultJavaExe()StringgetJavaExe()@Nullable ProcessgetLastProcess()StringgetMainClass()StringgetProgramArgs()List<String>getVmArgs()List<String>getXtraClassPath()booleanisEnableAssertions()voidjoin()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 JavaLaunchermake(String programArgs, String mainClass, List<String> classpathEntries, Logger logger)StringmakeClasspath()Compute the classpath for the spawned processstatic StringquoteStringIfNeeded(String s)Deprecated.voidsetEnableAssertions(boolean enableAssertions)voidsetJavaExe(String javaExe)voidsetProgramArgs(String s)Processstart()Launch the java process.StringtoString()-
Methods inherited from class com.ibm.wala.util.processes.Launcher
captureStdErr, captureStdOut, drainStdErr, drainStdOut, getEnv, getInput, getStderr, getStdOut, getWorkingDir, isCaptureErr, isCaptureOutput, setEnv, setInput, setStdErr, setStdOut, setWorkingDir, spawnProcess, spawnProcess
-
-
-
-
Method Detail
-
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
public String getJavaExe()
-
setJavaExe
public void setJavaExe(String javaExe)
-
setProgramArgs
public void setProgramArgs(String s)
-
getProgramArgs
public String getProgramArgs()
-
getMainClass
public String getMainClass()
-
defaultJavaExe
public static String defaultJavaExe()
- Returns:
- the string that identifies the java executable file
-
start
public Process start() throws IllegalArgumentException, IOException
Launch the java process.- Throws:
IllegalArgumentExceptionIOException
-
getLastProcess
public @Nullable Process getLastProcess()
-
join
public void join()
Wait for the spawned process to terminate.- Throws:
IllegalStateException- if the process has not been started
-
makeClasspath
public String makeClasspath()
Compute the classpath for the spawned process
-
quoteStringIfNeeded
@Deprecated public static String quoteStringIfNeeded(String s)
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
public void addVmArg(String arg)
-
-