PDA

View Full Version : help on java-gnome setup



rakis
October 16th, 2006, 08:43 AM
Hi all, I was just wondering if:
1) Anybody has java-gnome setup and working on their box
2) is running java-gnome using sun's java

I know this isn't the standard practice, and I'm not sure if it will even work... I'm just hoping it will so I won't have to hop between jvms.

I have managed to get everything installed correctly and am importing the glade/gtk libraries fine in eclipse.

however I'm receiving errors when running a simple test program:

java code (.glade file has 2 buttons inside a window, very simple):



import java.io.FileNotFoundException;
import java.io.IOException;

import org.gnu.glade.GladeXMLException;
import org.gnu.glade.LibGlade;
import org.gnu.gtk.Gtk;

public class MainGUI {

LibGlade glade;
public MainGUI() throws GladeXMLException, FileNotFoundException, IOException{
glade = new LibGlade("glade/gui.glade",this);
}

public static void main(String[] args) {
MainGUI maingui;
Gtk.init(args);
try{
maingui=new MainGUI();
}
catch(Exception e){
e.printStackTrace();
}
Gtk.main();
}
}


Error I'm getting:



Exception in thread "main" java.lang.UnsatisfiedLinkError: no gtkjni-2.8 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java :1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at org.gnu.gtk.Gtk.<clinit>(Gtk.java:214)
at project.MainGUI.main(MainGUI.java:23)


I then tried to run one of the tests on the java-gnome website and I get:



Arrakis:/usr/share/doc/libgnome-java/examples$ ./runExample.sh testgnome/TestGNOME
Java-Gnome Example Application Launcher

Package gtk2-java was not found in the pkg-config search path.
Perhaps you should add the directory containing 'gtk2-java.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk2-java' found
Arrakis:/usr/share/doc/libgnome-java/examples$



Of course this was all done after running:
sudo aptitude install libgtk-java libgnome-java libglade-java libgconf-java

Apparently when you are running programs in eclipse, you must also add a library path to access the static libraries that the jar's above require. Check this site:

http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/EclipseDevelopment

nereid
October 16th, 2006, 05:27 PM
Why don't you use SWING with the GTK look and feel?

rakis
October 16th, 2006, 08:24 PM
Eventually, I need to have this program run natively. Aside from having to learn GTK, I was opting to use a language I already knew extensively.

Any ideas from people that have gotten java-gnome setup/working it would be a great help if you could post how you did it!! Thanks!!

kathe
April 29th, 2007, 09:19 AM
hello

open this link thn u find the gnome java applications


http://linuxera.com/content/view/182/2/


kathe :)

Swege
May 17th, 2007, 08:30 PM
Hey rakis,

How did you add that library path? The link is broken, since the java-gnome pages no longer have stuff about Eclipse on there.

yatt
May 18th, 2007, 04:46 AM
-snip OP-

I've spent a good half hour trying to figure out the gtkjni-2.8 thing. I ended up getting nowhere. Maybe your link will help somewhat.

Why don't you use SWING with the GTK look and feel?
That's what I am doing, but you can still tell it is Swing.