com.mindbright.util
Class JarLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended bycom.mindbright.util.JarLoader

public class JarLoader
extends java.lang.ClassLoader

A ClassLoader which can load classes from a jar-file.


Constructor Summary
JarLoader(java.lang.String path, java.lang.String name)
          Construct an instance which looks for a jar-file with the given name somewhere in the given path.
 
Method Summary
 java.lang.Class findClass(java.lang.String name)
          Finds the class with the specified name.
 java.lang.Class loadClass(java.lang.String name, boolean resolve)
          Loads the given class.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarLoader

public JarLoader(java.lang.String path,
                 java.lang.String name)
          throws java.io.IOException
Construct an instance which looks for a jar-file with the given name somewhere in the given path.

Parameters:
path - a list of directories, separated by ':' or ';', to search in.
name - name, including suffix, of jarfile to look for
Throws:
java.io.IOException - if no jarfile with that name was found
Method Detail

findClass

public java.lang.Class findClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Finds the class with the specified name.

Parameters:
name - the name of the class to find
Returns:
the found class
Throws:
java.lang.ClassNotFoundException - if no matching class is found

loadClass

public java.lang.Class loadClass(java.lang.String name,
                                 boolean resolve)
                          throws java.lang.ClassNotFoundException
Loads the given class.

Parameters:
name - the name of the class to load
resolve - true of the class should be resolved as well
Returns:
The resulting Class object
Throws:
java.lang.ClassNotFoundException - if no matching class is found