laur.tools
Class JarClassLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--laur.tools.JarClassLoader

public class JarClassLoader
extends java.lang.ClassLoader

This class implements a simple class loader that can be used to load at runtime classes contained in a JAR file.


Constructor Summary
JarClassLoader(java.lang.String jarFileName)
          Creates a new JarClassLoader that will allow the loading of classes stored in a jar file.
 
Method Summary
 java.lang.Class findClass(java.lang.String className)
          Looks among the contents of the jar file (cached in memory) and tries to find and define a class, given its name.
 
Methods inherited from class java.lang.ClassLoader
defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarClassLoader

public JarClassLoader(java.lang.String jarFileName)
               throws java.io.IOException
Creates a new JarClassLoader that will allow the loading of classes stored in a jar file.
Parameters:
jarFileName - the name of the jar file
Throws:
java.io.IOException - an error happened while reading the contents of the jar file
Method Detail

findClass

public java.lang.Class findClass(java.lang.String className)
                          throws java.lang.ClassNotFoundException
Looks among the contents of the jar file (cached in memory) and tries to find and define a class, given its name.
Overrides:
findClass in class java.lang.ClassLoader
Parameters:
className - the name of the class
Returns:
a Class object representing our class
Throws:
java.lang.ClassNotFoundException - the jar file did not contain a class named className