build
Class CompilingClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended bybuild.LoadletClassLoader
          extended bybuild.CompilingClassLoader

public class CompilingClassLoader
extends LoadletClassLoader

A ClassLoader that will recompile the *.java file corresponding to an out of date or missing *.class file. It also runs rmic to generate *_Stub.class and *_Skel.class files used by RMI.

A single CompilingClassLoader uses a sequence of pairs of directories:

The -Dbootstrap.path System property can contain a sequence of classBase,srcBase pairs separated by ",". The default is "-Dbootstrap.path=.,.". For each class,src pair, a new CompilingClassLoader is constructed and chained to previous ones.

Sample Usage:

Supose we have a Java application, app, with the following files and classes: The to compile and run the application, do:
   javac -classpath app;jdk/lib/tools.jar -d app
         app/build/CompilingClassLoader.java

   java -Dbootstrap.path=app/classlib,app/src 
        -classpath app;jdk/lib/tools.jar
        CompilingClassLoader app.Main
   
The -classpath must provide access to CompilingClassLoader and tools.jar. It should not contain any directories for classes that you want recompiled. Specify them in -Dbootstrap.path instead.

When getting a class by name, use CompilingClassLoader.forName() rather than Class.forName(). This will recompile such classes as necessary.


Field Summary
 
Fields inherited from class build.LoadletClassLoader
loadlet
 
Constructor Summary
CompilingClassLoader(java.lang.ClassLoader parent, Loadlet loadlet)
           
 
Method Summary
static void main(java.lang.String[] args)
          Start your Java application through this main() as described above to get automatic compiling behavior.
 
Methods inherited from class build.LoadletClassLoader
findClass, getLoadlet
 
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, 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

CompilingClassLoader

public CompilingClassLoader(java.lang.ClassLoader parent,
                            Loadlet loadlet)
Method Detail

main

public static void main(java.lang.String[] args)
Start your Java application through this main() as described above to get automatic compiling behavior.