Class Launcher

    • Constructor Detail

    • Method Detail

      • launch

        protected void launch​(String[] args)
                       throws Exception
        Launch the application. This method is the initial entry point that should be called by a subclass public static void main(String[] args) method.
        Parameters:
        args - the incoming arguments
        Throws:
        Exception - if the application fails to launch
      • launch

        protected void launch​(String[] args,
                              String mainClass,
                              ClassLoader classLoader)
                       throws Exception
        Launch the application given the archive file and a fully configured classloader.
        Parameters:
        args - the incoming arguments
        mainClass - the main class to run
        classLoader - the classloader
        Throws:
        Exception - if the launch fails
      • createMainMethodRunner

        protected MainMethodRunner createMainMethodRunner​(String mainClass,
                                                          String[] args,
                                                          ClassLoader classLoader)
        Create the MainMethodRunner used to launch the application.
        Parameters:
        mainClass - the main class
        args - the incoming arguments
        classLoader - the classloader
        Returns:
        the main method runner
      • getMainClass

        protected abstract String getMainClass()
                                        throws Exception
        Returns the main class that should be launched.
        Returns:
        the name of the main class
        Throws:
        Exception - if the main class cannot be obtained
      • getClassPathArchives

        protected abstract List<ArchivegetClassPathArchives()
                                                       throws Exception
        Returns the archives that will be used to construct the class path.
        Returns:
        the class path archives
        Throws:
        Exception - if the class path archives cannot be obtained