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
  • 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 program
      mainClass - 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 program
      mainClass - 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 classpath
      captureOutput - 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()
    • getXtraClassPath

      public List<String> getXtraClassPath()
    • toString

      public String toString()
      Overrides:
      toString in class Launcher
    • defaultJavaExe

      public static String defaultJavaExe()
      Returns:
      the string that identifies the java executable file
    • start

      Launch the java process.
      Throws:
      IllegalArgumentException
      IOException
    • 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)
    • getVmArgs

      public List<String> getVmArgs()