This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
gcj-compiled HelloWorld.exe size
- From: Boris Kolar <boris dot kolar at globera dot com>
- To: java at gcc dot gnu dot org
- Date: Thu, 16 Jan 2003 02:34:23 +0100
- Subject: gcj-compiled HelloWorld.exe size
I'm new to gcj, so I haven't explored all options yet, but gcj really does
produce huge executables under MinGW.
The smallest exe I managed to produce with gcj is 1816064 bytes.
Source:
-------
public class HelloWorld {
public static void main(java.lang.String[] args) {
System.out.println("Hello world!");
}
}
Compiled with:
--------------
#gcj.exe -s --main=HelloWorld HelloWorld.java -o HelloWorld.exe
I've tried other options, but "-s" works as good as any.
After packing with UPX (www.upx.org) i got:
#upx.exe --best HelloWorld.exe
HelloWorld.exe: 495616 bytes
It's still too much! I'm considering using gcj for development of ActiveX
control, where some users will download it with 56k modem. So, executable size
is VERY important to me. Looking inside exe, I found a lot of classes that I
never use. I guess most dependancies come from java.langClass.
The next step I tried was to provide my dummy implementation for basic classes
(Object, Class, String, Throwable,...) packed all in a zip and tried to compile
it with "--bootclass=." option. The compilation failed because of duplicate
definitions in libgcj. But if I try to compile with "-nostdlib", I get many more
errors.
Many people don't need most libgcj classes anyway, so why should every
executable contain them? I'd like to have a stripped-down version of libgcj,
which would contain only the most basic classes (Object, Class, maybe String).
How can I do that?
regards,
boris