org.codehaus.plexus.classworlds.launcher
public class Launcher extends Object
ClassRealm
s
from a configuration file and the launching of the application's main
method from the correct class loaded through the correct classloader.
The path to the configuration file is specified using the classworlds.conf
system property, typically specified using the -D
switch to
java
.
Version: $Id$
Field Summary | |
---|---|
protected static String | CLASSWORLDS_CONF |
int | exitCode |
protected String | mainClassName |
protected String | mainRealmName |
protected ClassLoader | systemClassLoader |
protected static String | UBERJAR_CONF_DIR |
protected ClassWorld | world |
Constructor Summary | |
---|---|
Launcher() |
Method Summary | |
---|---|
void | configure(InputStream is)
Configure from a file.
|
protected Method | getEnhancedMainMethod()
Retrieve the enhanced main entry method.
|
int | getExitCode() |
Class | getMainClass()
Retrieve the main entry class.
|
String | getMainClassName() |
protected Method | getMainMethod()
Retrieve the main entry method.
|
ClassRealm | getMainRealm()
Retrieve the main entry realm.
|
String | getMainRealmName() |
ClassLoader | getSystemClassLoader() |
ClassWorld | getWorld() |
void | launch(String[] args)
Launch the application.
|
protected void | launchEnhanced(String[] args)
Attempt to launch the application through the enhanced main method.
|
protected void | launchStandard(String[] args)
Attempt to launch the application through the standard main method.
|
static void | main(String[] args)
Launch the launcher from the command line.
|
static int | mainWithExitCode(String[] args)
Launch the launcher.
|
void | setAppMain(String mainClassName, String mainRealmName) |
void | setSystemClassLoader(ClassLoader loader) |
void | setWorld(ClassWorld world) |
Parameters: is The config input stream.
Throws: IOException If an error occurs reading the config file. MalformedURLException If the config file contains invalid URLs. ConfigurationException If the config file is corrupt. org.codehaus.plexus.classworlds.realm.DuplicateRealmException If the config file defines two realms with the same id. org.codehaus.plexus.classworlds.realm.NoSuchRealmException If the config file defines a main entry point in a non-existent realm.
Returns: The enhanced main entry method.
Throws: ClassNotFoundException If the main entry class cannot be found. NoSuchMethodException If the main entry method cannot be found. NoSuchRealmException If the main entry realm cannot be found.
Returns: The main entry class.
Throws: ClassNotFoundException If the class cannot be found. NoSuchRealmException If the specified main entry realm does not exist.
Returns: The main entry method.
Throws: ClassNotFoundException If the main entry class cannot be found. NoSuchMethodException If the main entry method cannot be found. NoSuchRealmException If the main entry realm cannot be found.
Returns: The main entry realm.
Throws: NoSuchRealmException If the specified main entry realm does not exist.
Parameters: args The application args.
Throws: ClassNotFoundException If the main entry class cannot be found. IllegalAccessException If the method cannot be accessed. InvocationTargetException If the target of the invokation is invalid. NoSuchMethodException If the main entry method cannot be found. NoSuchRealmException If the main entry realm cannot be found.
public static void main(String[] args, ClassWorld world)
Parameters: args The application args.
Throws: ClassNotFoundException If the main entry class cannot be found. IllegalAccessException If the method cannot be accessed. InvocationTargetException If the target of the invokation is invalid. NoSuchMethodException If the main entry method cannot be found. NoSuchRealmException If the main entry realm cannot be found.
public static void main(String[] args)
Parameters: args The application args.
Throws: ClassNotFoundException If the main entry class cannot be found. IllegalAccessException If the method cannot be accessed. InvocationTargetException If the target of the invokation is invalid. NoSuchMethodException If the main entry method cannot be found. NoSuchRealmException If the main entry realm cannot be found.
Parameters: args The application command-line arguments.
Parameters: args The application command-line arguments.
Returns: an integer exit code
Throws: Exception If an error occurs.