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]

GCJ Windows and SWT


I recently read an article about creating native GUI apps written in Java
with SWT as the GUI library and found my way to GCJ. I wrote a small test
app on Windows and it runs well on windows and JRE 1.4.1 but fails when
compiled with GCJ and executed as a native app. The app launches fine but
crashes soon after I open a file with the app. The file open function loads
a CSV file into a table and does some simple processing. The app seems to be
crashing in a separate thread that updates the GUI by calling:

            display.syncExec (new Runnable ()
            {
             public void run ()
             {
              setStatusMessage("Loading Carveouts " + new Date());
             }
            });

I tried debugging but "print e" only displays the class name. See below.

(gdb) bt
#0  com.mpv.FormatCarveout.Main.main(java.lang.String[]) (args=@cb8fe0)
    at com/mpv/FormatCarveout/Main.java:637
#1  0x005c862d in gnu::gcj::runtime::FirstThread::call_main() ()
#2  0x0054ef49 in _Jv_ThreadRun(java::lang::Thread*) ()
#3  0x005359fa in _Jv_RunMain(java::lang::Class*, char const*, int, char
const**
, bool) ()
#4  0x00535acb in JvRunMain ()
#5  0x004012bb in main (argc=1, argv=@3f24d8)
(gdb) p e
$5 = java.lang.Throwable@1746480
(gdb)

This leads to lots of questions. Has anyone successfully created a Java &
SWT app with GCJ on Windows? I am sure the answer is yes but I am looking
for examples that use a seperate thread to update the GUI like I described
above or significant examples not just the Eclipse examples or small
sinppets. How do I print objects with the debugger? Where does
System.out.println() output go? How stable is GCJ? Is there a FAQ about
debugging problems with GCJ. I can send the source code to my app but I
didn't want to post it to email due to size. Maybe I'll try writing a
smaller app that uses the Display.syncExec() method to see if this is the
issue. Any suggestions or pointers about GCJ would be appreciated.


Here is the version info for GCJ:
C:\GCJ\source\FormatCarveout>gcj -v
Reading specs from C:/GCJ/bin/../lib/gcc-lib/mingw32/3.2/specs
Reading specs from
C:/GCJ/bin/../lib/gcc-lib/mingw32/3.2/../../../libgcj.spec
rename spec lib to liborig
Configured with: /extra/src/gcc/gcc-3.2/configure --prefix=/extra/wingcc
--build
=i686-pc-linux-gnu --host=mingw32 --target=mingw32
--enable-languages=c,c++,java
 --with-gcc --with-gnu-as --with-gnu-ld --with-as=/extra/xgcc/bin/mingw32-as
--w
ith-ld=/extra/xgcc/bin/mingw32-ld --enable-threads=win32 --disable-nls
--disable
-win32-registry --disable-shared --disable-debug --disable-multilib
--without-ne
wlib --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm
--dis
able-libgcj-debug --enable-interpreter --enable-hash-synchronization
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)

J.R.


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