LWJGL Forum

Programming => General Java Game Development => Topic started by: Raelifin on December 29, 2007, 20:16:09

Title: Having trouble making a jar on linux
Post by: Raelifin on December 29, 2007, 20:16:09
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.

Thanks!
- Max

Using:

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"
Title: Re: Having trouble making a jar on linux
Post by: Raelifin on December 29, 2007, 20:35:16
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. :)
Title: Re: Having trouble making a jar on linux
Post by: Matzon on December 30, 2007, 08:11:58
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.