Hello Guest

[solved] odd library problem with lwjgl.jar (linux)

  • 3 Replies
  • 6905 Views
[solved] odd library problem with lwjgl.jar (linux)
« on: January 04, 2011, 03:44:29 »
I have the path to the lwjgl.jar in the call to the java program: java -Djava.library.path=/usr/share/lwjgl/jar MusicPlayerClient

When I have no further lwjgl.jar in the CLASSPATH I get the message java.lang.NoClassDefFoundError: org/lwjgl/openal/OpenALException

Code: [Select]
root@Microknoppix:/usr/share/lwjgl# echo $CLASSPATH
/usr/share/lwjgl/slick/lib/ibxm.jar:/usr/share/lwjgl/slick/lib/jogg-0.0.7.jar:/usr/share/lwjgl/slick/lib/jorbis-0.0.15.jar:/usr/share/lwjgl/slick/lib/slick-util.jar:.:/home/knoppix/JMF-2.1.1e/lib/jmf.jar:.:::
root@Microknoppix:/usr/share/lwjgl# java -Djava.library.path=/usr/share/lwjgl/jar MusicPlayerClient
Exception in thread "Thread-2" java.lang.NoClassDefFoundError: org/lwjgl/openal/OpenALException
at org.newdawn.slick.openal.AudioLoader.init(AudioLoader.java:33)
at org.newdawn.slick.openal.AudioLoader.getAudio(AudioLoader.java:48)
at JukeOggSound.oggSound(JukeOggSound.java:30)
at MusicPlayerClient.run(MusicPlayerClient.java:44)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.openal.OpenALException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 5 more
root@Microknoppix:/usr/share/lwjgl#

When I have an extra lwjgl.jar in the CLASSPATH i get the message java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path

Code: [Select]
root@Microknoppix:/usr/share/lwjgl# echo $CLASSPATH
/usr/share/lwjgl/slick/lib/ibxm.jar:/usr/share/lwjgl/slick/lib/jogg-0.0.7.jar:/usr/share/lwjgl/slick/lib/jorbis-0.0.15.jar:/usr/share/lwjgl/slick/lib/slick-util.jar:/usr/share/lwjgl/jar/lwjgl.jar:.:/home/knoppix/JMF-2.1.1e/lib/jmf.jar:.:::
root@Microknoppix:/usr/share/lwjgl# java -Djava.library.path=/usr/share/lwjgl/jar MusicPlayerClient
Tue Jan 04 04:19:38 CET 2011 INFO:Initialising sounds..
Exception in thread "Thread-2" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:82)
at org.lwjgl.Sys.<clinit>(Sys.java:99)
at org.lwjgl.openal.AL.<clinit>(AL.java:59)
at org.newdawn.slick.openal.SoundStore$1.run(SoundStore.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at org.newdawn.slick.openal.SoundStore.init(SoundStore.java:292)
at org.newdawn.slick.openal.AudioLoader.init(AudioLoader.java:33)
at org.newdawn.slick.openal.AudioLoader.getAudio(AudioLoader.java:48)
at JukeOggSound.oggSound(JukeOggSound.java:30)
at MusicPlayerClient.run(MusicPlayerClient.java:44)
at java.lang.Thread.run(Thread.java:636)
root@Microknoppix:/usr/share/lwjgl#

And here the library directories:

Code: [Select]
root@Microknoppix:/usr/share/lwjgl/jar# ls -la
insgesamt 2288
drwxr-xr-x 2 root root   2048  4. Jan 02:20 .
drwxr-xr-x 5 root root     80  4. Jan 03:00 ..
-rwxr-xr-x 1 root root   4189 18. Okt 21:44 AppleJavaExtensions.jar
-rwxr-xr-x 1 root root 214859 18. Okt 21:44 jinput.jar
-rwxr-xr-x 1 root root 880824 18. Okt 21:44 lwjgl-debug.jar
-rwxr-xr-x 1 root root 867028 18. Okt 21:44 lwjgl.jar
-rwxr-xr-x 1 root root 206493 18. Okt 21:44 lwjgl_test.jar
-rwxr-xr-x 1 root root  31423 18. Okt 21:44 lwjgl_util_applet.jar
-rwxr-xr-x 1 root root 127598 18. Okt 21:44 lwjgl_util.jar
-rwxr-xr-x 1 root root   5762 18. Okt 21:44 lzma.jar

root@Microknoppix:/usr/share/lwjgl/slick/lib# ls -la
insgesamt 200
drwxr-xr-x 2 root root  2048  4. Jan 02:20 .
drwxr-xr-x 3 root root  2048 19. Dez 18:19 ..
-rwxr-xr-x 1 root root 37714 12. Mai 2007  ibxm.jar
-rwxr-xr-x 1 root root  6543 12. Mai 2007  jogg-0.0.7.jar
-rwxr-xr-x 1 root root 58917 12. Mai 2007  jorbis-0.0.15.jar
-rwxr-xr-x 1 root root 95908 23. Nov 2009  slick-util.jar
root@Microknoppix:/usr/share/lwjgl/slick/lib#

What am I doing wrong?
« Last Edit: January 04, 2011, 11:12:47 by Cottonwood »
Regards. Cottonwood.

Re: odd library problem with lwjgl.jar (linux)
« Reply #1 on: January 04, 2011, 04:03:04 »
a) As already explain in other topics. -Djava.library.path must point to the location of the native files (for linux .so) - not to the .jar files.
b) Don't use the environment variable CLASSPATH - that's bad. Specify the class path with -cp or specify it in your application JAR file's manifest.

Re: odd library problem with lwjgl.jar (linux)
« Reply #2 on: January 04, 2011, 04:32:11 »
To be specific, this is what you want (fill in the path where appropriate):

Code: [Select]
java -Djava.library.path=/usr/share/lwjgl/native/linux -cp .:/usr/share/lwjgl/slick/lib/ibxm.jar:/usr/share/lwjgl/slick/lib/jogg-0.0.7.jar:/usr/share/lwjgl/slick/lib/jorbis-0.0.15.jar:/usr/share/lwjgl/slick/lib/slick-util.jar:/home/knoppix/JMF-2.1.1e/lib/jmf.jar:lwjgl.jar:lwjgl_util.jar:jinput.jar:mymusicplayer.jar: MusicPlayerClient

Also, it looks like you're using the LWJGL provided in the Linux software repositories, unless you installed LWJGL to "/usr/share..." yourself.   LWJGL in the Linux (Ubuntu/Debian that I'm aware of) software repositories are very outdated.  If you aren't using those, then disregard this last paragraph.
cool story, bro

Re: odd library problem with lwjgl.jar (linux)
« Reply #3 on: January 04, 2011, 11:12:21 »
As already explain in other topics.

Sorry for asking. ;) ::)
Thanks a lot. :) :-*
Regards. Cottonwood.