Class EmbeddedLauncher
java.lang.Object
org.codehaus.classworlds.Launcher
org.codehaus.classworlds.EmbeddedLauncher
Command-line invokable application launcher.
This launcher class assists in the creation of classloaders and
ClassRealms
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: EmbeddedLauncher.java 78 2004-07-01 13:59:13Z jvanzyl $
- Author:
- bob mcwhirter
-
Field Summary
FieldsFields inherited from class org.codehaus.classworlds.Launcher
CLASSWORLDS_CONF, mainClassName, mainRealmName, systemClassLoader, UBERJAR_CONF_DIR, world -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MethodRetrieve the enhanced main entry method.Retrieve the main entry class.Retrieve the main entry class name.Retrieve the main entry realm.Retrieve the main entry realm name.voidlaunch()protected voidlaunchX()Attempt to launch the application through the enhanced main method.voidsetAppMain(String mainClassName, String mainRealmName) Set the application's main entrypoint.Methods inherited from class org.codehaus.classworlds.Launcher
configure, getExitCode, getMainMethod, getSystemClassLoader, getWorld, launch, launchEnhanced, launchStandard, main, mainWithExitCode, setSystemClassLoader, setWorld
-
Field Details
-
LAUNCH_METHOD
-
-
Constructor Details
-
EmbeddedLauncher
public EmbeddedLauncher()
-
-
Method Details
-
setAppMain
Set the application's main entrypoint.- Overrides:
setAppMainin classLauncher- Parameters:
mainClassName- The main class name.mainRealmName- The realm to load the class from.
-
getMainRealmName
Retrieve the main entry realm name.- Overrides:
getMainRealmNamein classLauncher- Returns:
- The main entry realm name.
-
getMainClassName
Retrieve the main entry class name.- Overrides:
getMainClassNamein classLauncher- Returns:
- The main entry class name.
-
getMainClass
Retrieve the main entry class.- Overrides:
getMainClassin classLauncher- Returns:
- The main entry class.
- Throws:
ClassNotFoundException- If the class cannot be found.NoSuchRealmException- If the specified main entry realm does not exist.
-
getMainRealm
Retrieve the main entry realm.- Overrides:
getMainRealmin classLauncher- Returns:
- The main entry realm.
- Throws:
NoSuchRealmException- If the specified main entry realm does not exist.
-
getEnhancedMainMethod
protected Method getEnhancedMainMethod() throws ClassNotFoundException, NoSuchMethodException, NoSuchRealmExceptionRetrieve the enhanced main entry method.- Overrides:
getEnhancedMainMethodin classLauncher- 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.
-
launchX
protected void launchX() throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NoSuchRealmExceptionAttempt to launch the application through the enhanced main method. This will seek a method with the exact signature of:public static void main(String[] args, ClassWorld world)
- 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.
-
launch
-