|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.sfac.launcher.ApplicationLauncher
public class ApplicationLauncher
Class able to dynamically setup the java classpath and launch another main class using this new classpath.
It uses a URLClassLoader to dynamically load all the jars in a given directory (like "./lib").
See displayUsage() method for command line explanations.
This class is alone in one Maven project to be able to produce a jar containing only this class. It's because, it's better that all the jars of the application are in a single ClassLoader (the URLClassLoader setup by this class). So, to avoid class loading problems, it's better that the intermediate ClassLoader (the usual application ClassLoader) contains as less class as possible.
| Field Summary | |
|---|---|
static String |
BASE_DIR_KEY
|
static String |
EXTRA_PARAMS_KEY
|
static String |
LAUNCHER_PROPERTIES_KEY
|
static String |
LIB_PATH_KEY
|
static String |
MAIN_CLASS_KEY
|
static String |
RECURSIVE_LIB_SEARCH_KEY
|
static String |
SHOW_HELP_KEY
|
static String |
VERBOSE_KEY
|
| Constructor Summary | |
|---|---|
ApplicationLauncher(Properties cmdLineProperties)
Instantiate a launcher using the given 'library' directories. |
|
| Method Summary | |
|---|---|
File |
getBaseDir()
|
void |
launchApplication()
Start given the application using the newly instantiated URLClassloader. |
static void |
main(String[] args)
Parse the argument string to instantiate the ApplicationLauncher and call startApplication on it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String BASE_DIR_KEY
public static final String EXTRA_PARAMS_KEY
public static final String LAUNCHER_PROPERTIES_KEY
public static final String LIB_PATH_KEY
public static final String MAIN_CLASS_KEY
public static final String RECURSIVE_LIB_SEARCH_KEY
public static final String SHOW_HELP_KEY
public static final String VERBOSE_KEY
| Constructor Detail |
|---|
public ApplicationLauncher(Properties cmdLineProperties)
libDirectories - List of directories containing the jar files to add to the classpathverbose - When true, display verbose messages to System.out| Method Detail |
|---|
public File getBaseDir()
public void launchApplication()
throws Exception
Exceptionpublic static void main(String[] args)
ApplicationLauncher and call startApplication on it. displayUsage() method for command line explanations.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||