Class JavaLauncher


  • public class JavaLauncher
    extends Launcher
    A Java process launcher
    • Method Detail

      • make

        public static JavaLauncher make​(java.lang.String programArgs,
                                        java.lang.String mainClass,
                                        java.util.List<java.lang.String> classpathEntries,
                                        java.util.logging.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​(java.lang.String programArgs,
                                        java.lang.String mainClass,
                                        boolean inheritClasspath,
                                        java.util.List<java.lang.String> classpathEntries,
                                        boolean captureOutput,
                                        boolean captureErr,
                                        java.util.logging.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 java.lang.String getJavaExe()
      • setJavaExe

        public void setJavaExe​(java.lang.String javaExe)
      • setProgramArgs

        public void setProgramArgs​(java.lang.String s)
      • getProgramArgs

        public java.lang.String getProgramArgs()
      • getMainClass

        public java.lang.String getMainClass()
      • getXtraClassPath

        public java.util.List<java.lang.String> getXtraClassPath()
      • toString

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

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

        public java.lang.Process start()
                                throws java.lang.IllegalArgumentException,
                                       java.io.IOException
        Launch the java process.
        Throws:
        java.lang.IllegalArgumentException
        java.io.IOException
      • getLastProcess

        public java.lang.Process getLastProcess()
      • join

        public void join()
        Wait for the spawned process to terminate.
        Throws:
        java.lang.IllegalStateException - if the process has not been started
      • makeClasspath

        public java.lang.String makeClasspath()
        Compute the classpath for the spawned process
      • quoteStringIfNeeded

        @Deprecated
        public static java.lang.String quoteStringIfNeeded​(java.lang.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​(java.lang.String arg)
      • getVmArgs

        public java.util.List<java.lang.String> getVmArgs()