Thread: [Java-gnome-developer] errors
Brought to you by:
afcowie
From: Damien C. <da...@co...> - 2003-12-13 23:24:35
|
Hi, I'm new to Java-gnome and I am trying to get up and running. I'm attempting to run the simplest of programs from the Java-gnome tutorial : > // First we import the libraries used by this example > import org.gnu.gnome.App; > import org.gnu.gnome.Program; > import org.gnu.gtk.Gtk; > > public class First { > > public static void main(String[] args) { > // Initialization > Program.initGnomeUI("First", "0.1", args); > > App app = new App("First", "First App"); > app.show(); > > Gtk.main(); > } > } I can compile this easy enough with javac First.java. However when I try to run java -cp . First is get: > [damien@localhost GnomeApp]$ java -cp . First > Exception in thread "main" java.lang.UnsatisfiedLinkError: no GTKJava > in java.library.path > at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491) > at java.lang.Runtime.loadLibrary0(Runtime.java:788) > at java.lang.System.loadLibrary(System.java:834) > at org.gnu.glib.GObject.<clinit>(GObject.java:154) > at First.main(First.java:10) > [damien@localhost GnomeApp]$ Does anyone have any ideas about how to fix this? I have build java-gnome and places all the .jar 's in /usr/java/j2sdk1.4.2_02/jre/lib/ext. Regards -- Damien Covey <www.covey.net.au> |
From: Damien C. <da...@co...> - 2003-12-14 13:12:41
|
I've included my classpath and details of how I am compiling/running. Hope you can help. Alex Moreno wrote: >It seems that your classpath is not correct. You should make >CLASSPATH='/usr/java/j2sdk1.4.2_02/jre/lib/ext'. And with an only 'java >First' it shoul work. The '-cp .' argument is not necessary because java >includes the working directory by default. > >Try to fix it or send us your 'echo $CLASSPATH' to let us help you. > [damien@localhost GnomeApp]$ echo $CLASSPATH /usr/share/java-1.4.2:/usr/share/java-gnome:/usr/share/java-1.3.1:/usr/java/j2sdk1.4.2_02/jre/lib/ext/:/usr/java/j2sdk1.4.2_02/jre/lib/ext/:. [damien@localhost GnomeApp]$ javac First.java [damien@localhost GnomeApp]$ java First Exception in thread "main" java.lang.UnsatisfiedLinkError: no GTKJava in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491) at java.lang.Runtime.loadLibrary0(Runtime.java:788) at java.lang.System.loadLibrary(System.java:834) at org.gnu.glib.GObject.<clinit>(GObject.java:154) at First.main(First.java:10) > >On Tue, 2003-12-16 at 10:22, Damien Covey wrote: > > >>Hi, >> >>I'm new to Java-gnome and I am trying to get up and running. >> >>I'm attempting to run the simplest of programs from the Java-gnome >>tutorial : >> >> >> >>>// First we import the libraries used by this example >>>import org.gnu.gnome.App; >>>import org.gnu.gnome.Program; >>>import org.gnu.gtk.Gtk; >>> >>>public class First { >>> >>> public static void main(String[] args) { >>> // Initialization >>> Program.initGnomeUI("First", "0.1", args); >>> >>> App app = new App("First", "First App"); >>> app.show(); >>> >>> Gtk.main(); >>> } >>>} >>> >>> >>I can compile this easy enough with javac First.java. >>However when I try to run java -cp . First is get: >> >> >> >>>[damien@localhost GnomeApp]$ java -cp . First >>>Exception in thread "main" java.lang.UnsatisfiedLinkError: no >>>GTKJava in java.library.path >>> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491) >>> at java.lang.Runtime.loadLibrary0(Runtime.java:788) >>> at java.lang.System.loadLibrary(System.java:834) >>> at org.gnu.glib.GObject.<clinit>(GObject.java:154) >>> at First.main(First.java:10) >>>[damien@localhost GnomeApp]$ >>> >>> >>Does anyone have any ideas about how to fix this? >>I have build java-gnome and places all the .jar 's in >>/usr/java/j2sdk1.4.2_02/jre/lib/ext. >> >>Regards >> >>-- >>Damien Covey >> >> -- Damien Covey www.covey.net.au |
From: Mark H. <mh...@ca...> - 2003-12-14 13:25:53
|
On Tue, Dec 16, 2003 at 07:22:51PM +1000, Damien Covey wrote: > >[damien@localhost GnomeApp]$ java -cp . First > >Exception in thread "main" java.lang.UnsatisfiedLinkError: no GTKJava > >in java.library.path > > at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491) > > at java.lang.Runtime.loadLibrary0(Runtime.java:788) > > at java.lang.System.loadLibrary(System.java:834) > > at org.gnu.glib.GObject.<clinit>(GObject.java:154) > > at First.main(First.java:10) > >[damien@localhost GnomeApp]$ You need to tell java where the jni libraries are located. This is done by setting LD_LIBRARY_PATH export LD_LIBRARY_PATH=/usr/lib/java-gnome (or wherever you installed them) -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... | mh...@ca... |
From: Damien C. <da...@co...> - 2003-12-14 13:38:05
|
Mark Howard wrote: >On Tue, Dec 16, 2003 at 07:22:51PM +1000, Damien Covey wrote: > > >>>[damien@localhost GnomeApp]$ java -cp . First >>>Exception in thread "main" java.lang.UnsatisfiedLinkError: no GTKJava >>>in java.library.path >>> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491) >>> at java.lang.Runtime.loadLibrary0(Runtime.java:788) >>> at java.lang.System.loadLibrary(System.java:834) >>> at org.gnu.glib.GObject.<clinit>(GObject.java:154) >>> at First.main(First.java:10) >>>[damien@localhost GnomeApp]$ >>> >>> > >You need to tell java where the jni libraries are located. This is done >by setting LD_LIBRARY_PATH >export LD_LIBRARY_PATH=/usr/lib/java-gnome >(or wherever you installed them) > > > Ahh, excelent, its working. Is there some to overcome the need to set this manually? Can this be done when Java-Gnome is install? Regards -- Damien Covey |
From: Mark H. <mh...@ca...> - 2003-12-14 13:46:22
|
On Sun, Dec 14, 2003 at 11:37:41PM +1000, Damien Covey wrote: > Ahh, excelent, its working. > > Is there some to overcome the need to set this manually? Can this be > done when Java-Gnome is install? Only installing the .so's in /usr/lib. That is generally not recommended for jni libraries though. -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... | mh...@ca... |
From: Alex M. <ale...@fa...> - 2003-12-14 13:16:00
|
Hi, it seems that your classpath is not correct. You should makeCLASSPATH='/usr/java/j2sdk1.4.2_02/jre/lib/ext'. And with an only 'javaFirst' it shoul work. The '-cp .' argument is not necessary because javaincludes the working directory by default. Try to fix it or, if you continue having problems, send us your 'echo $CLASSPATH' to let us help you. > On Tue, 2003-12-16 at 10:22, Damien Covey wrote: > > Hi, > > > > I'm new to Java-gnome and I am trying to get up and running. > > > > I'm attempting to run the simplest of programs from the Java-gnome > > tutorial : > > > > > // First we import the libraries used by this example > > > import org.gnu.gnome.App; > > > import org.gnu.gnome.Program; > > > import org.gnu.gtk.Gtk; > > > > > > public class First { > > > > > > public static void main(String[] args) { > > > // Initialization > > > Program.initGnomeUI("First", "0.1", args); > > > > > > App app = new App("First", "First App"); > > > app.show(); > > > > > > Gtk.main(); > > > } > > > } > > I can compile this easy enough with javac First.java. > > However when I try to run java -cp . First is get: > > > > > [damien@localhost GnomeApp]$ java -cp . First > > > Exception in thread "main" java.lang.UnsatisfiedLinkError: no > > > GTKJava in java.library.path > > > at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491) > > > at java.lang.Runtime.loadLibrary0(Runtime.java:788) > > > at java.lang.System.loadLibrary(System.java:834) > > > at org.gnu.glib.GObject.<clinit>(GObject.java:154) > > > at First.main(First.java:10) > > > [damien@localhost GnomeApp]$ > > > > Does anyone have any ideas about how to fix this? > > I have build java-gnome and places all the .jar 's in > > /usr/java/j2sdk1.4.2_02/jre/lib/ext. > > > > Regards > > > > -- > > Damien Covey -- Alex Moreno |