org.glite.ce.commonj.utils
Class JarClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.glite.ce.commonj.utils.JarClassLoader
- public class JarClassLoader
- extends java.net.URLClassLoader
A class loader for loading jar files, both local and remote.
- Author:
- Luigi Zangrando (zangrando@pd.infn.it)
Constructor Summary |
JarClassLoader(java.lang.String href,
java.lang.ClassLoader parent)
Creates a new JarClassLoader for the specified url. |
JarClassLoader(java.net.URL url,
java.lang.ClassLoader parent)
|
Method Summary |
void |
addJarURL(java.lang.String href)
|
void |
addJarURL(java.net.URL url)
|
java.lang.String |
getMainClassName(java.net.URL sensorURL)
Returns the name of the jar file main class, or null if
no "Main-Class" manifest attributes was defined. |
void |
invokeClass(java.lang.String name,
java.lang.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.net.URLClassLoader |
addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
defineClass |
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 |
JarClassLoader
public JarClassLoader(java.lang.String href,
java.lang.ClassLoader parent)
throws java.net.MalformedURLException
- Creates a new JarClassLoader for the specified url.
JarClassLoader
public JarClassLoader(java.net.URL url,
java.lang.ClassLoader parent)
addJarURL
public void addJarURL(java.net.URL url)
throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
addJarURL
public void addJarURL(java.lang.String href)
throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
getMainClassName
public java.lang.String getMainClassName(java.net.URL sensorURL)
throws java.io.IOException
- Returns the name of the jar file main class, or null if
no "Main-Class" manifest attributes was defined.
- Parameters:
sensorURL
-
- Throws:
java.io.IOException
invokeClass
public void invokeClass(java.lang.String name,
java.lang.String[] args)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.ClassNotFoundException,
java.lang.NoSuchMethodException,
java.lang.reflect.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:
java.lang.ClassNotFoundException
- if the specified class could not be found
java.lang.NoSuchMethodException
- if the specified class does not contain a "main" method
java.lang.reflect.InvocationTargetException
- if the application raised an exception
java.lang.IllegalAccessException
java.lang.InstantiationException