A day in the life of Danny D'Amours

Java-Gnome – GTK programming in Java

After writing my last java-gnome post, I decided to look a bit deeper and quickly noticed that the java-gnome bindings in the Fedora 7 repository are in fact version 2.12 and not the latest version 4.0.3. Version 2.12 is no longer being supported and maintained and it fact only covers GTK up to version 2.6 which is a fairly old release.

I hunted a bit for rpm packages of java-gnome 4.03 and despite claims to the contrary, the rpms are not in the Fedora 7 repository. proceeded to download the 4.0.3 source to install it.

The defaults for java-gnome 4.0.3 seem to assume that you wish to use gcj and gij as your compiler and runtime environment. Dubious assumption to make I would say. I tried to tell configure that I wanted to use javac as my compiler and java as my runtime using "configure compiler=javac runtime=java" but it complained about a “bad override” so I ended up having to point configure to my java installation location using "configure jdk=/etc/alternatives/java_sdk_1.6.0".

Once configured, a quick make and a sudo make install commands and I was ready to go.

Luckily with java-gnome 4.0.3, all of bindings are contained in one jar file gtk-4.0.jar. I could then remove the old 2.12 jars from my library path and add the gtk-4.0.jar file which had been installed into my /usr/share/java folder.

There was one minor code modification required in order to get my previous example working which was to rename the imported packages from org.gnu.gtk.xxx to org.gnome.gtk.xxx. With this done the previous example works just as before.

Again, the next step is to get a little more action displayed than a simple button that has no functionality. 🙂

Related Posts:

August 21st, 2007 Posted by Danny D'Amours | Java, Tech | no comments

No Comments »

No comments yet.

Leave a comment

css.php