I am writing a game in Java using the Slick2D 2D engine.
In the Eclipse IDE, the project works properly, and when building and running through File> Export, the Runnable JAR File doesn’t go beyond the main menu written in Swing - the native libraries obviously don’t load.
Despite the fact that all the .jar and .dll libraries in the archive were present, and there were a couple of tutorials at hand, attempts to manually register them in manifest / build.xml / classpath at various stages of assembly failed miserably.
I tried to download them in the source code through:

System.loadLibrary("lwjgl");

or

 File lib1 = new File("lib/windows/lwjgl.dll"); System.load(lib1.getAbsolutePath()); 

Again, the IDE works like a clock, but the Runnable JAR is gone.

    1 answer 1

    The solution was found in the book Slick2D Game Development , which I managed to download in the depths of the network.
    They became the program JarSplice , which collects the project.
    How2Use:

    • First you need to create a non-executable JAR file.
      (In my case, it was necessary to exclude lwjgl.jar, slick.jar, jinput.jar and .classpath from the assembly, otherwise a duplicate error occurred during the assembly)

    • On the Add Jars tab, add your jar from item 1, and the necessary libraries.
      (In my case, just the ones that I excluded in paragraph 1. If you don’t exclude them from the assembly in the IDE, but don’t add them when building in JarSplice, the project will not work)

    • Add native libraries to Add Natives tab
    • On the tab (who would have thought! ..) Main Class register the main class
    • Create, in fact, the final jar-file