This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Report on GCJ as packaging tool for SWT applications


I'm trying to use GCJ to package my SWT application as 
a native executable, so as not to require the installation 
of the JRE. 
 
GCJs design fits the bill nicely, though there are 
stumbling blocks.
 
I've succeeded in compiled a SWT hello world 
application, but I'm struggling with various issues 
for my main application. 

Some of my experiences could perhaps be distilled into 
useful bug-reports; though I don't know where else to 
post them than on this mailing list.

To compile a SWT hello world application, I did the 
following:
 
1) Starting with the following command line to launch my HelloSWT app:
 
java.exe -classpath=helloswt.jar;swt.jar HelloSWT
 
2) To avoid compilation errors, mangle the swt.jar library a bit:
 
zip -d swt.jar *AWT*
 
2) Rewrite to a GCJ command line:
 
gcj --main=HelloSWT -o helloswt.exe -fjni helloswt.jar swt.jar 
 
3) Run helloswt.exe
 
helloswt.exe is 9MB on disk, but zipped it takes 2.5MB. Although 
it is surprising that helloswt.exe contains a lot of "air", I 
don't particularly care. Download size is what matters. 
Comparision: Visual Basic produces a ~2MB zipped download size for 
a basic app. 
 
For my real world application, I've currently got several 
showstoppers:
 
- I'm using java.util.prefs, this does not appear to 
be supported. My attempts to extract java.util.prefs 
from my JRE rt.jar failed miserably. 
- Ditto for java.util.regex

Compilation aborts, so I don't know if this is a complete list
of my showstoppers. I use a serial port JNI dlls from serialio.com,
shouldn't be a big deal, I do use JRE 1.4, though I don't know
what else might be "missing" in the GCJ environment.

A minor issue: I couldn't find a way to turn off the warning below
(-Wno-unreachable-bytecode did not work).
....
org/eclipse/swt/graphics/ImageData.java:2378: warning: unreachable bytecode from 2061 to before 2064
...
 


 
Øyvind
 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]