org.argouml.application.security
Class ArgoJarClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.argouml.application.security.ArgoJarClassLoader
- public class ArgoJarClassLoader
- extends URLClassLoader
A class loader for loading jar files, both local and remote.
This source was taken primarily from
Sun's tutorial
Nested classes inherited from class java.lang.ClassLoader |
|
Method Summary |
String |
getMainClassName()
Returns the name of the jar file main class, or null if
no "Main-Class" manifest attributes was defined. |
void |
invokeClass(String name,
String[] args)
Invokes the application in this jar file given the name of the
main class and an array of arguments. |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
url
private URL url
ArgoJarClassLoader
public ArgoJarClassLoader(URL u)
- Creates a new ClassLoader for the specified url.
- Parameters:
u
- the url of the jar file
getMainClassName
public String getMainClassName()
throws IOException
- Returns the name of the jar file main class, or null if
no "Main-Class" manifest attributes was defined.
- Returns:
- the name of the main class
- Throws:
IOException
- if we can not access the file
invokeClass
public void invokeClass(String name,
String[] args)
throws ClassNotFoundException,
NoSuchMethodException,
InvocationTargetException
- Invokes the application in this jar file given the name of the
main class and an array of arguments. The class must define a
static method "main" which takes an array of String arguemtns
and is of return type "void".
- Parameters:
name
- the name of the main classargs
- the arguments for the application
- Throws:
ClassNotFoundException
- if the specified class could not
be found
NoSuchMethodException
- if the specified class does not
contain a "main" method
InvocationTargetException
- if the application raised an
exception