| java.lang.Object java.lang.ClassLoader build.LoadletClassLoader build.CompilingClassLoader
CompilingClassLoader | public class CompilingClassLoader extends LoadletClassLoader (Code) | | 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:
- classBase - where to look for *.class files.
- srcBase - where to look for *.java files.
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:
- app.Main - Main class of the application.
- app/classlib/ - class file directory.
- app/src/ - java file directory.
- app/build/ - where this file is
- jdk/lib/tools.jar - JDK *.jar file containing javac.
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.
|
Method Summary | |
public static void | main(String[] args) Start your Java application through this main() as described
above to get automatic compiling behavior. |
main | public static void main(String[] args)(Code) | | Start your Java application through this main() as described
above to get automatic compiling behavior.
|
Methods inherited from java.lang.ClassLoader | public synchronized void clearAssertionStatus()(Code)(Java Doc) final protected Class> defineClass(byte[] b, int off, int len) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, byte[] b, int off, int len) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, java.nio.ByteBuffer b, ProtectionDomain protectionDomain) throws ClassFormatError(Code)(Java Doc) protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException(Code)(Java Doc) protected Class> findClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected String findLibrary(String libname)(Code)(Java Doc) final protected Class> findLoadedClass(String name)(Code)(Java Doc) protected URL findResource(String name)(Code)(Java Doc) protected Enumeration<URL> findResources(String name) throws IOException(Code)(Java Doc) final protected Class> findSystemClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected Package getPackage(String name)(Code)(Java Doc) protected Package[] getPackages()(Code)(Java Doc) final public ClassLoader getParent()(Code)(Java Doc) public URL getResource(String name)(Code)(Java Doc) public InputStream getResourceAsStream(String name)(Code)(Java Doc) public Enumeration<URL> getResources(String name) throws IOException(Code)(Java Doc) public static ClassLoader getSystemClassLoader()(Code)(Java Doc) public static URL getSystemResource(String name)(Code)(Java Doc) public static InputStream getSystemResourceAsStream(String name)(Code)(Java Doc) public static Enumeration<URL> getSystemResources(String name) throws IOException(Code)(Java Doc) public Class> loadClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected synchronized Class> loadClass(String name, boolean resolve) throws ClassNotFoundException(Code)(Java Doc) final protected void resolveClass(Class> c)(Code)(Java Doc) public synchronized void setClassAssertionStatus(String className, boolean enabled)(Code)(Java Doc) public synchronized void setDefaultAssertionStatus(boolean enabled)(Code)(Java Doc) public synchronized void setPackageAssertionStatus(String packageName, boolean enabled)(Code)(Java Doc) final protected void setSigners(Class> c, Object[] signers)(Code)(Java Doc)
|
|
|