public abstract class Launcher extends Object
Constructor and Description |
---|
Launcher() |
Modifier and Type | Method and Description |
---|---|
protected ClassLoader |
createClassLoader(List<Archive> lib)
Create a classloader for the specified lib.
|
protected ClassLoader |
createClassLoader(URL[] urls)
Create a classloader for the specified URLs
|
protected Runnable |
createMainMethodRunner(String mainClass,
String[] args,
ClassLoader classLoader)
Create the
MainMethodRunner used to launch the application. |
protected String |
getMainClass(Archive archive)
Obtain the main class that should be used to launch the application.
|
protected abstract boolean |
isNestedArchive(Archive.Entry jarEntry)
Determine if the specified
JarEntry is a nested item that should be added
to the classpath. |
void |
launch(String[] args)
Launch the application.
|
protected void |
launch(String[] args,
Archive archive)
Launch the application given the archive file
|
protected void |
launch(String[] args,
Archive archive,
ClassLoader classLoader)
Launch the application given the archive file and a fully configured classloader.
|
protected void |
launch(String[] args,
ProtectionDomain protectionDomain)
Launch the application given the protection domain.
|
protected void |
postProcessLib(Archive archive,
List<Archive> lib)
Called to post-process lib entries before they are used.
|
public void launch(String[] args)
public static void main(String[] args)
method.args
- the incoming argumentsprotected void launch(String[] args, ProtectionDomain protectionDomain) throws Exception
args
- the incoming argumentsprotectionDomain
- the protection domainException
protected void launch(String[] args, Archive archive) throws Exception
args
- the incoming argumentsarchive
- the underlying (zip/war/jar) archiveException
protected abstract boolean isNestedArchive(Archive.Entry jarEntry)
JarEntry
is a nested item that should be added
to the classpath. The method is called once for each entry.jarEntry
- the jar entrytrue
if the entry is a nested item (jar or folder)protected void postProcessLib(Archive archive, List<Archive> lib) throws Exception
archive
- the archivelib
- the existing libException
protected ClassLoader createClassLoader(List<Archive> lib) throws Exception
lib
- the libException
protected ClassLoader createClassLoader(URL[] urls) throws Exception
urls
- the URLsException
protected void launch(String[] args, Archive archive, ClassLoader classLoader) throws Exception
args
- the incoming argumentsarchive
- the archiveclassLoader
- the classloaderException
protected String getMainClass(Archive archive) throws Exception
Start-Class
manifest entry.archive
- the archiveException
protected Runnable createMainMethodRunner(String mainClass, String[] args, ClassLoader classLoader) throws Exception
MainMethodRunner
used to launch the application.mainClass
- the main classargs
- the incoming argumentsclassLoader
- the classloaderException
Copyright © 2013. All rights reserved.