This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: java.lang.ClassLoader
"Veena Murthy" <vmurthy@nortelnetworks.com> writes:
> Can anyone point me to code examples for using java.lang.ClassLoader.
Kawa (http://www.gnu.org/software/kawa/) uses ClassLoader twice:
* gnu.bytecode.ZipLoader manages a .zip (or .jar) archive, and
loades classes as needed from the the archive. This is used when
Kawa compiles a Scheme source files into a "compiled form" consisting
of a set of classes grouped in a .zip file.
* gnu.bytecode.ArrayClassLoader manages a bunch of classes in raw
byte[] format. When Kawa is running interactively, source code
is compiled into a collection of gnu.bytecode.ClassType objects,
one for each generates class. Then the writeToArry method is
called on each ClassType, giving a byte[][], one byte[] for
each class. The byte[][] is uses to construct a ArrayClassLoader.
When the compiled code is executed, it loaded the newly-compiled
classes form the ArrayClassLoader.
Avarious people are using the Kawa compilation framework
(gnu.bytecode and gnu.expr) is to compile various languages to
Java bytecodes. I am using it for Scheme and Emacs Lisp; there
is also a never-got-very-far implementation of EcmaScript/JavaScript.
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/