Classes in ROM

Erik Bruchez Erik.Bruchez at iname.com
Mon Feb 2 10:06:36 PST 1998


Michael Schroeder wrote:

> I do not have a filesystem, so that the classes cannot be loaded at
> runtime.

Actually, you don't need a real filesystem to load the classes at
runtime. Kaffe's integrated class loader looks for classes on a local
filesystem (either raw .class files or classes bundled in a .zip), but
it's very easy to change this in order to have it load all classes
from a single zip file image in memory, the zip file being considered
as a kind of read-only filesystem. All that is needed by Kaffe at some
point is an array of bytes in memory representing a given class file,
so even if for some reason you don't want to use a zip image you will
have a simple solution.

I did it for an embedded system, and it was trivial to change this
part of Kaffe to work this way, at least with 0.8.x. How you get the
zip image is another question: it can be somewhere in EPROM of Flash,
downloaded from a network (that's what I did), or could be in an
object file linked with Kaffe. I put in the zip file only the system
classes that I really needed, plus the classes of my application, and
ended up with someting taking approx. 300 KB. This size can be
dramatically reduced if you don't need all java.io, etc.

-Erik



More information about the kaffe mailing list