PDA

View Full Version : libjava-gnome-java problems



Renault #
April 7th, 2009, 10:31 PM
I installed libjava-gnome-java from Synaptic, but I don't know how to get it to work on Ubuntu. What I mean is that I don't know how to set it up so that import statements like



import org.gnome.gdk.Event;
import org.gnome.gtk.Gtk;


will work.

Has anyone done this? I'm not much of a Linux boffin. :(

Thanks

myrtle1908
April 8th, 2009, 12:34 AM
You need to reference the relevant libraries. Where are the gnome/gtk JAR files located? Are you using an IDE like Eclipse? If so you need to add the JARs to the build path.

HotCupOfJava
April 8th, 2009, 05:55 AM
The problem isn't directly related to Linux. This would happen on any OS. You need to make sure that the .jar files containing the classes you need are added to the java classpath at compile and runtime. There are several ways to do this. The least intrusive (but most annoying due to the extra typing) is to actually set the classpath as you run the javac and java commands:


javac -classpath "directoryx/directoryy/mylibrary.jar:." MySourceFile.java

then to run the same:


java -classpath "directoryx/directoryy/mylibrary.jar:." MySourceFile