Exporting to Runable Jar Gives Unsatisfied link eror

Im using lwjgl and Slick2d for a small application that I wish to export and send to a friend. (its a Mag Feeding timer for JP PSO2)

but when I export to Runable jar, it dosent work and when I go into the cmd and run it as java -jar MagTimer.jar it gives me a unsatisfied Link error, Which ive seen before… when I didnt know I needed to link the Natives in the build path. but I have and it runs fine in eclipse. How do i export to Jar WITH the natives and libraries?

Long time ago, there was a 16 years old piano player boy from Greek taught me this…

Configure your build path, make your all your required libs are checked on Export tab. Then on export, pick Jar file (first option, runnable jar is third) and select to extract required libs on folder alongside the jar (whatever, third option). You should get a jar and a directory containning libs with name youJarName_libs.

Not Greek, Egyptian! ;D

@OP
Add '-Djava.library.path=“relative/path/to/natives/folder” to your command so it looks like this:


java -Djava.library.path="natives/windows/" -jar MagTimer.jar

For more info and options on how to run LWJGL applications, read this article I wrote on the LWJGL wiki: http://lwjgl.com/wiki/index.php?title=Distributing_Your_LWJGL_Application

Rather use Java Web Start. Some people might fail to run your game because your JAR will be opened by WinRAR or Arch… I’m too young to repeat the same things…

If you just want an executable jar for your Slick2D application then you can use JarSplice to do this for you.

Export your project classes and resources (images, sound, etc) into a normal non runnable jar. Then run JarSplice, on the jar tab add your jar and all the external libraries you are using (lwjgl.jar, slick.jar, etc), add all the natives you are using on the native tabs, specify your main class and click to create an executable jar.

Additionally you can also use it to create platform specific executables (i.e. windows .exe files, OS X .app files, etc).

@ra4king
I kinda forgot ;D