GCJ and Java-Gtk on Win32

fernando@lozano.eti.br fernando@lozano.eti.br
Wed Feb 19 14:09:00 GMT 2003

Hi there,

As I look the only one on this list interested on using GTK+
from Java under
Win32 ;-) I decided ti try the build myself. I`ve compiled
java-gnome under
Linux some times without problems, but what problems can
happen using
configure/make on a GNU system? :-)

On Windows I am using the latest releases from Mingw (2.0.3)
and Msys (1.0.9)
together with december pre-release GCJ. Java-Gnome needs a
Java2 SDK and I use
Sun 1.4.0_02. I guess it should be possible by now to
compile java-gnome using
just GCC/GCJ but Ill try this on Linux later before trying
on Win32.

I understand this may not be the correct list; but as I have
no clue about
patching configure scripts and the like, or about the
potential gotchas of this
combo (native Win32 Java SDK + Mingsys-based makefiles and
configure tools +
Mingw GCC) I guess you can provide me some guidance.

I installed the software above on c:\soft and downloaded
WinGTK+ 0.2 from
sourceforge to get Win32 DLLs and include files for GTK+. I
had to download
also libglade 0.17 from the same site and create a standard
directory struture
(include, lib) for it.

Then entered /c/soft/java-gnome-0.7.1 and run configure

configure --with-gtk-only --with-gtk-prefix=/c/soft/wingtk

To make configure happy I had to provide scripts for
gtk-config and
libglade-config which were not suplied by wingtk 0.2. I
patched them to return:

$ gtk-config --libs

lozano@LAB15 /c/soft/wingtk/bin
$ libglade-config --libs
-L/c/soft/libglade/lib -lglade -lxml -lz

configure went fine and generated a makefile (I am not
sending full logs
because this may be boring and I just want someone to tell
me if I did
something fundamentally wrong). I had to edit the makefile
so Sun JDK is happy
with the CLASSPATH envorinment variable.

Then make compiled some java-gnome specific Java classes
that generate
definitions for JNI calls to the GTK+ library. After that
Java classes
themselves were compiled without a problem. Some C sources
where compiled fine
until I got the error:

gcc -c -g -O2 -fPIC -Iother gnu/jni/gnu_gtk_GtkWindow.c -o
gnu/jni/gnu_gtk_GtkWindow.o -I /c/j2sdk1.4.0/include -I
/c/j2sdk1.4.0/include/win32 -I/c/soft/wingtk/include
-I/usr/X11R6/include \
     -I/usr/include/gnome-xml -I/c/soft/libglade/include
-I/usr/lib/glib/include -I/usr/X11R6/include -DGTK
cc1.exe: warning: -fPIC ignored for target (all code is
position independent)
In file included from c:/soft/wingtk/include/gdk/gdk.h:33,
                 from c:/soft/wingtk/include/gtk/gtk.h:31,
                 from gnu/jni/gnu_gtk_GtkWindow.h:24,
                 from gnu/jni/gnu_gtk_GtkWindow.c:22:
c:/soft/wingtk/include/gdk/gdkdnd.h:99:8: warning: extra
tokens at end of
#endif directive
gnu/jni/gnu_gtk_GtkWindow.c: In function
gnu/jni/gnu_gtk_GtkWindow.c:330: structure has no member
named `window_has_focus'
gnu/jni/gnu_gtk_GtkWindow.c: In function
make[2]: *** [gnu/jni/gnu_gtk_GtkWindow.o] Error 1
make[2]: Leaving directory
make[1]: *** [gtk] Error 2

[]s, Fernando Lozano

More information about the Java mailing list