Qwylt

java.lang.module.spi
Class Launcher

java.lang.Object
  extended by java.lang.module.spi.Launcher

public class Launcher
extends java.lang.Object

A module launcher.

Since:
Jul 27, 2009
Author:
Bryan Atsatt

Constructor Summary
Launcher(java.lang.String moduleQuery)
          Constructor.
Launcher(java.lang.String moduleQuery, ModuleRepository repository)
          Constructor.
Launcher(java.lang.String moduleQuery, ModuleSystem moduleSystem)
          Constructor.
Launcher(java.lang.String query, ModuleSystem moduleSystem, ModuleRepository repository)
          Constructor.
 
Method Summary
 java.lang.ClassLoader getClassLoader()
          Returns the loader of the selected module.
static Launcher getInstance()
          Returns the singleton instance.
 java.lang.String getMainClassName()
          Returns the main class name from the selected module.
 Module getModule()
          Returns the selected module.
static boolean isModularRuntime()
          Returns whether or not the singleton module launcher was used to start this process.
 void launch(java.lang.String... arguments)
          Executes the main(String[]) method of the main class, passing the specified arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Launcher

public Launcher(java.lang.String moduleQuery)
Constructor. Uses the root module system to parse the query and the system repository to find the module specified by the query.

Parameters:
moduleQuery - The query string.
Throws:
java.lang.RuntimeException - If the query is invalid, the specified module cannot be found, the specified module does not name a main class, or if the main class cannot be found.

Launcher

public Launcher(java.lang.String moduleQuery,
                ModuleRepository repository)
Constructor. Uses the specified repository to find the module specified by the query.

Parameters:
moduleQuery - The query string.
repository - The repository to use to find the module specified by the query.
Throws:
java.lang.RuntimeException - If the query is invalid, the specified module cannot be found, the specified module does not name a main class, or if the main class cannot be found.

Launcher

public Launcher(java.lang.String moduleQuery,
                ModuleSystem moduleSystem)
Constructor. Uses the specified module system to parse the query and the system repository to find the module specified by the query.

Parameters:
moduleQuery - The query string.
moduleSystem - The module system to use to parse the query.
Throws:
java.lang.RuntimeException - If the query is invalid, the specified module cannot be found, the specified module does not name a main class, or if the main class cannot be found.

Launcher

public Launcher(java.lang.String query,
                ModuleSystem moduleSystem,
                ModuleRepository repository)
Constructor.

Parameters:
query - The query string.
moduleSystem - The module system to use to parse the query.
repository - The repository to use to find the module specified by the query.
Throws:
java.lang.RuntimeException - If the query is invalid, the specified module cannot be found, the specified module does not name a main class, or if the main class cannot be found.
Method Detail

getInstance

public static Launcher getInstance()
Returns the singleton instance.

Returns:
The instance.

isModularRuntime

public static boolean isModularRuntime()
Returns whether or not the singleton module launcher was used to start this process.

Returns:
true if the singleton launcher was used to start this process.

getModule

public Module getModule()
Returns the selected module.

Returns:
The Module.

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns the loader of the selected module.

Returns:
The ClassLoader.

getMainClassName

public java.lang.String getMainClassName()
Returns the main class name from the selected module.

Returns:
The class name.

launch

public void launch(java.lang.String... arguments)
Executes the main(String[]) method of the main class, passing the specified arguments.

Parameters:
arguments - The arguments.
Throws:
java.lang.RuntimeException - If main method cannot be invoked.

Qwylt

Send comments or questions to Bryan Atsatt