Problems using the GCJ interpreter
Ranjit Mathew
rmathew4lists@hotmail.com
Thu Feb 20 03:56:00 GMT 2003
>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.
More information about the Java
mailing list