Class JavaLauncher


  • public class JavaLauncher
    extends Object
    JavaLauncher Provides an easy way to launch java applications.
    • Constructor Detail

      • JavaLauncher

        public JavaLauncher()
    • Method Detail

      • exec

        public static Process exec​(String mainClass,
                                   String classpath,
                                   String[] jvmargs,
                                   String[] properties)
                            throws Exception
        Launch a java program.
        Parameters:
        mainClass - - class with main method
        classpath - - the java classpath
        jvmargs - - arguments for the jvm
        properties - - any system properties
        Returns:
        the launched process
        Throws:
        Exception - An error happened during execution
      • execJar

        public static Process execJar​(String pathToJar,
                                      String[] jvmargs)
                               throws Exception
        Execute a java jar file that contains a manifest.
        Parameters:
        pathToJar - - absolute path to your jar
        jvmargs - - arguments for the java virtual machine
        Returns:
        Process The launched process
        Throws:
        Exception - An error happened during execution
      • findJVM

        public static String findJVM()
        Find a suitable JVM on the user's system.
        Returns:
        - path to java binary
      • main

        public static void main​(String[] args)
        Demo - Launch a java program.
        Parameters:
        args - the invocation arguments