Getting demos.gears.Gears to work

I have built the cvs checkout of jogl and jogl-demos without any problems, but I still can’t get the demos to work. I am running debian. The following is the output I get when I type “java demos.gears.Gears”:

Exception in thread “main” java.lang.UnsatisfiedLinkError: no jogl 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 net.java.games.jogl.impl.NativeLibLoader$1.run(NativeLibLoader.java:60)
at java.security.AccessController.doPrivileged(Native Method)
at net.java.games.jogl.impl.NativeLibLoader.(NativeLibLoader.java:46)
at net.java.games.jogl.impl.x11.X11GLContextFactory.(X11GLContextFactory.java:50)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at net.java.games.jogl.impl.GLContextFactory.getFactory(GLContextFactory.java:69)
at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:150)
at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:118)
at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:85)
at demos.gears.Gears.main(Gears.java:18)

mlm@orion:~$ echo $CLASSPATH
/usr/local/jogl/build/jogl.jar:/usr/local/jogl/jogl-demos/build/jogl-demos-data.jar:/usr/local/jogl/jogl-demos/build/jogl-demos.jar:/usr/local/jogl/jogl-demos/build/jogl-demos-util.jar

mlm@orion:~$ echo $PATH
/usr/local/jogl/build/obj:/usr/local/ant/bin:/usr/local/java/bin:/sbin:/usr/sbin:/usr/local/sbin:/home/mlm/lc3/lc3tools:/home/mlm/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/java/bin:/usr/local/ant/bin

I have also include the settings for my path and classpath. If anyone could help, I would greatly appreciate it.

thanks,
Mike

After much jacking around and googling. I think I figured it out. The VM couldn’t find the native library for jogl. I’m not sure if what I did is really acceptable by java standards, but it works.

I made a sym link to the “libjogl.so” file in /usr/local/java/jre/lib/i386

where /usr/local/java is where JAVA_HOME points to, which is the base directory where java is located.

Sooooooo /usr/local/java/jre/lib/i386/libjogl.so -> /usr/local/jogl/build/obj/libjogl.so

Also, I don’t know if this matters, but I “chmod 555 libjogl.so”

I found a website that said the .so files need to be executable, but I 'm not exactly sure this is true.

Actually…libjogl.so doesn’t have to be executable. 444 is working fine.

After much more pain I have found a way to avoid doing the symlink. I ran into a situation where I was on a box that I didn’t have write access to the directory, so I had to find the command line way of doing it.

java -Djava.library.path="/p/share/jogl/precompiled/jogl-natives-linux" demos.gears.Gears

Instead of using the -D option to java you can add the following to your .bash_profile:

export LD_LIBRARY_PATH=/p/share/jogl/precompiled/jogl-natives-linux

java looks at the LD_LIBRARY_PATH environment variable for where to look for custom JNI libraries.

-Mike

I think the above should work under MacOSX and windows. Is there any way someone could add this to the docs? :slight_smile:

I could edit the docs and email it to someone if it helps.