[kaffe] reducing size of rt.jar for embedded platforms

Dalibor Topic robilad at kaffe.org
Tue Mar 14 03:25:44 PST 2006

d greene wrote:
> hello all,

Hi dgreene,

> In 1.1.4 I was able to reduce rt.jar to 1.5M, but with 1.1.6 I'm only
> able to reduce to 6M (so far). I'm finding that there are probably too
> many cross package dependencies on crypto, swing, awt, for instance, so
> I'm unable to easily remove those all those packages that I'm not using
> (and yes  I used all the configure switches to disable awt, sound, etc)
> without getting runtime errors.

I've written up how to get minimal rt.jars using the old (which changed
since the big GNU Classpath merge in CVS after 1.1.6) build system here:


> Any hints on how to easily reduce rt.jar would be appreciated. 

> It would
> help if "--with-awt=no" would actually not include any awt and swing
> packages in rt.jar.  

That's a rather hard problem, since there are both native and Java
dependencies for something like AWT. So to cleanly separate things, one
would need to keep both the native code and the java code makefiles up
to date.

I've tried maintaining class library profiles by hand in the past, and
that sort of work is not much fun, since the class library is evolving
so quickly. I am not aware of any tool that can generate adequate
makefiles with correct dependency information for both C and Java code

I've played with early releases of
http://www-out.bell-labs.com/project/nmake/release/jdeps.html a few
years ago without much success, see
http://kaffe.org/pipermail/kaffe/2003-October/044289.html for details.

The tools probably have improved since, so if you feel like giving it a
shot, please tell us how it went.

> I don't need (and I'm guess most embedded
> platforms) graphics, sound, xml, rmi, applet, corba (and security for
> now). A single switch for a minimal rt.jar would be nice.

Yeah. While classpath's build system also has support for excluding
class from the build, I think the simplest way to create minimal rt.jars
for applicatons should to use one of the various bytecode munging tools
made for that. An Ant task, for example, that 'packs' a jar is available
at http://sadun-util.sourceforge.net/pack.html

If you try it out, please report back how it worked.

dalibor topic

More information about the kaffe mailing list