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]

Re: Problems using the GCJ interpreter


>I read up on the FAQ. Is it true that the GCJ interpreter does not
>work under Windows? The information seems a bit out of date, when I read
>this mailing list.

No, it does work under Windows. To see it in action:

File Foo.java:
----------------------------------------------------------------
public class Foo {
    public String toString( ) { return "Not in my name!"; }
}
----------------------------------------------------------------
File Bar.java:
----------------------------------------------------------------
public class Bar {
    public static void main(String[] args) {
        System.out.println( Class.forName( "Foo").newInstance( ));
    }
}
----------------------------------------------------------------
Then:
    gcj -C Foo.java
    gcj --main=Bar Bar.java

The fact that it shows Foo.toString( ) means that it works.

To be really certain, change the string in Foo.toString( ) and
just compile (to a .class) Foo.java again without recompiling 
Bar.java - you'll see the updated string.

As Tom pointed out, when you directly reference classes in your
code, they are statically resolved and without libswt.a, you
get the errors you see.

Hope this helps.

Ranjit.


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