Binary size of statically linked java application

Lehner, Michael michaellehner@siemens.com
Thu Nov 30 11:25:00 GMT 2006


> -----Original Message-----
> From: Marco Trudel [mailto:mtrudel@gmx.ch]
> Sent: Thursday, November 30, 2006 11:26 AM
> To: Lehner, Michael; GCJ
> Subject: Re: Binary size of statically linked java application
> 
> Lehner, Michael wrote:
> > <snip>
> >
> >>> I will leave all the ideas in my head, because I don't know in the
> >>> moment how this all will end up and what way would be the best
then.
> >>> Writing stubs for the whole classpath will be a bit too time
> > consuming.
> >> Actually it can all be automated. I have most of it automated
> > already...
> >
> > [Lehner, Michael]
> > You have automated writing the stubs?
> 
> No, but that wouldn't be that a big deal. The rest is automated :-)
> 

[Lehner, Michael] 
I think you should be a little more precise in what you automated.

> 
> >>> But you said, that you had written stubs for awt,... Can you send
> > they
> >>> perhaps to me? This would save me some time to redo work you
already
> >>> did.
> >> I attached the JARs for removing the GUI and for removing
> > javax.crypto.
> >
> > [Lehner, Michael]
> > noGui.jar is working fine for me, but noJce.jar throws me lots of
errors
> > like that:
> > .../libgcj.a(provider.o): (.data.rel+0x510): multiple definition of
> > 'gnu::java::security::provider::DefaultPolicy::Gnu::class$'
> > .../stubs.o: (.data.rel+0x4a4): first defined here
> 
>  From my FAQ:
> 
> Why do I get "multiple definitions of ..." errors when excluding the
GUI
> or JCE?
> That means that your code is using and thus pulling AWT/Swing or JCE
> into the binary. You have to either uncheck the "exclude GUI/JCE" box
or
> change/delete your classes that need the libraries.
> 

[Lehner, Michael] 
Hm, there are only two things which could do that, I am only printing to
the console and using the CNI to call a C++ function. But I am not sure
if this could cause these faults.

> 
> > Your noGui also seems as efficient as my way, I got down to 6,2MB
and
> > yours got me only to 6,6MB. But perhaps I threw out an additional
Object
> > File.
> 
> Yeah, right. Without JCE, it will be about 4.5mb. I only kick the
> objects containing classes with swing, awt, applet, print or imageio
in
> the package name.
> 

[Lehner, Michael] 
Ah, I see what I additionally removed. I think you didn't remove
beans.o. I threw it out, because by removing it most of the errors
disappeared. That's also the reason, why I only had to write fewer stubs
than you did. It is about 0,4MB.

> 
> Marco
> 
> PS: Please always reply to all. There might be other people being
> interested in this thread.

[Lehner, Michael] 
I am sorry for that, I hit the wrong button. I hope this won't occur
again.

Michael



More information about the Java mailing list