Having trouble making a jar on linux

Started by Raelifin, December 29, 2007, 20:16:09

Previous topic - Next topic


Hey, I'm trying to compile my project into a jar, but I'm having trouble linking the native (liblwjgl.so) into the project's classpath. When I make a jar on windows it works as long as I include lwjgl.dll in the root folder next to the jar, but this fails on linux. I can make and run jars just fine as long as they don't require an external library. Any help here would be wonderful, as googling it hasn't gotten me anything.

- Max


  • Ubuntu Linux 7.10 (Gutsy)
  • Eclipse 3.2.2 SDK
  • FatJar utility (for compressing the jar)
  • lwjgl 1.1.3
  • Slick - a library by Kevin Glass (http://slick.cokeandcode.com/)

EDIT: Oh, and I figure it'd be relevant to include the error, which, predictably is:
"Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path"


Okay, I feel stupid now. After talking with a friend over IM, I am now versed in the "-Djava" command.

For the sake of those who are having the same problem, the solution is to run the jar with the following command:

java -Djava.library.path=./ -jar YourProject.jar

Make sure you have the .so file in the same directory too, or else change the path to where it is located.

Sorry for the wasted thread. :)


It's a general issue, and not one we can do a lot about.
Basically the native files can be anywhere on your system - as long as you specify the path to them using -Djava.library.path=/path/to/native
Normally its fine to have it in the current working directory, but it seems that linux doesn't like that, which is why you have to specify ./ which is current folder.