java-gnome and gcj

Olivier olivier@zipworld.com.au
Sun Jul 15 03:40:00 GMT 2001


Hi,
I have been trying to get java-gnome to work with gcj.
Java-GNOME ( http://java-gnome.sourceforge.net ) is a set of Java 
bindings for GNOME and GTK libraries. It is implemented as a JNI layer.
I have managed to compile the First example from their tutorial with 
gcj but runing it fails with the following message:
tournesol:~/program/java/gnome/gcj$ ./First 
Gtk-CRITICAL **: file gtkwindow.c: line 438 (gtk_window_set_focus): assertion `GTK_IS_WIDGET (focus)' failed.
Obviously, it's not very helpful! Before I go any further I would like
to check the steps I did to compile java-gnome and this example. Maybe
I have done a beginers mistake. If you think everything is ok I'll try to
debug the example and figure out what's breaking.
Thank you very much.
Following are the steps I've done:
- Step 1
 compiled java-gnome out of the box with jdk1.3 and gcc2.95.4
 got gnome.jar and gtk.jar (the java wrappers)
 and libGNOMEJava.so, libGTKJava.so (the native methods).
 I have tested various examples with jdk1.3, it is all working.
- Step 2
 recompiled all the java wrappers (packages gnu.gtk, gnu.gdk, 
 and gnu.gnome) with gcj as follow:
 
 for fjava in `find . -name '*.java'`; do
 fo=${fjava/.java/.o}
 gcj -fPIC -fjni --classpath=$CLASSPATH -o $fo -c $fjava
 done
 objects=`find . -name '*.o'`
 gcj -shared $objects -o gnu.so
 which gave me 'gnu.so' lib.
- Step 3
 Recompiled First.java example as follow:
 LIBGCJ_JAR=/usr/local/gcc/share/libgcj.jar
 GTK_JAR=~/tmp/java-gnome-0.6.0/lib/gtk.jar
 GNOME_JAR=~/tmp/java-gnome-0.6.0/lib/gnome.jar
 gcj -fPIC --classpath=$LIBGCJ_JAR:$GTK_JAR:$GNOME_JAR -o tutorial/First.o -c tutorial/First.java
 gcj -o First --main=First tutorial/First.o gnu.so
- Step 4 
 ran the example:
 #set LD path to contain gnu.so, libGNOMEJava.so and libGTKJava.so
 export LD_LIBRARY_PATH=/usr/local/gcc/lib:~/tmp/java-gnome-0.6.0/lib:.
 ./First
which output:
 Gtk-CRITICAL **: file gtkwindow.c: line 438 (gtk_window_set_focus): assertion `GTK_IS_WIDGET (focus)' failed.
and does not display anything.
Thanks.
Olivier
-- 
----------------------------------------------------------------------
Olivier Louchart-Fletcher
Email: olivier@zipworld.com.au


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /