exception handling

Christian Stuellenberg gcj@stuellenberg.de
Tue Sep 16 22:50:00 GMT 2003


Hello,

I've got some problems with exceptions.
I'm trying to do something like follows:

public class CCTest {
    public static void main(String[] args) {
        try {
            throw new Exception("TTT");
        } catch (Exception e) {
            System.out.println("CATCHED!");
        }
        System.out.println("SUCCESS");
    }
}

I'm compiling that with
$ mingw32-gcj -o c.exe --main=CCTest CCTest.java -L./lib -lgcj \
-Wl,--enable-runtime-pseudo-reloc

I'm using
$ mingw32-gcj -v
Configured with: '../gcc-3.4-20030830/configure' '--target=mingw32 '--prefix=/site.opt/mingw32-cross '--without-newlib '--enable-shared '--enable-libgcj '--enable-threads=win32 '--enable-languages=c,c++,java '--disable-nls '--disable-debug '--with-gcc '--with-gnu-as '--with-gnu-ld '--without-newlib '--disable-win32-registry '--enable-libgcj '--disable-java-awt '--without-x '--enable-java-gc=boehm '--disable-libgcj-debug '--enable-interpreter '--enable-hash-synchronization '--enable-sjlj-exceptions
Thread model: win32
gcc version 3.4 20030830 (experimental)

When I now execute the generated executable on a windows host, I get
an Exception; so the Exception gets not catched.

What I`m doing wrong here?

Kind regards,
Christian



More information about the Java mailing list