|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sapia.util.ApplicationStarter
public class ApplicationStarter
The application starter allows to execute the main(String[]) method of a
java class from a child classloader of the system classloader. This delegation of the
execution of a java class to a child classloader allows an application to be independant
in the classes that it loads (because they are not loaded by the system classloader)
and give the opportunity to other java application to be loaded by other child classloader
of the system classloader without any clash of class name.
The application starter can be called with different options:
Here is two examples of the usage of the application starter. The first example will show
the online help message of the application starter and exit. The second example would create
a new classloader that would contain the file C:\test.jar as only resource, create a new thread
and, from that new thread, call the method main(String[]) on the class MyMainClass
passing the two arguments 'foo' and 'bar'.
java org.sapia.util.ApplicationStarter -ashelpjava org.sapia.util.ApplicationStarter -asdebug -ascp C:\test.jar MyMainClass foo bar
Finally the application starter can be called programmatically using the start method.
| Constructor Summary | |
|---|---|
protected |
ApplicationStarter(java.lang.Class aMainClass,
java.lang.String[] someArguments)
Creates a new ApplicationStarter with the passed in arguments. |
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
Main method of the ApplicationStarter class. |
void |
run()
Run method of the Runnable interface that calls the main method of the main class. |
static void |
start(java.lang.String aClasspath,
java.lang.String aClassName,
java.lang.String[] someArguments,
boolean isDebug)
This start method allow the ApplicationStarter to start a new application programmatically passing in the required arguments. |
static void |
usage()
Prints out on the standard output the usage of the main method of this class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ApplicationStarter(java.lang.Class aMainClass,
java.lang.String[] someArguments)
aMainClass - The class on which to call the main() method.someArguments - The array of argument to pass to the main class.| Method Detail |
|---|
public static void main(java.lang.String[] args)
main(String[]) method of the class.
args - The arguments that define the options of the application starter.
public static void start(java.lang.String aClasspath,
java.lang.String aClassName,
java.lang.String[] someArguments,
boolean isDebug)
throws ApplicationStarterException
aClasspath - The list of resources that defines the classpath use to start the application.
Each resource of the classpath must be seperated by the system path seperator defined by
the path.separator system proprety and by the static attribute
java.io.File.pathSeparator.aClassName - The qualified name of the class that contains the main() method to start.someArguments - The arguments that would be passed to the main() method of the class.isDebug - Indicates of it start the application in debug mode or not.
ApplicationStarterException - If an error occurs while starting the application.public static void usage()
public void run()
run in interface java.lang.Runnable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||