Can't start .jar file (using LWJGL)

后端 未结 2 496
无人共我
无人共我 2020-12-21 07:18

Good day!

I created jar file (using Netbeans) and i can\'t start it. This project uses lwjgl libraries. Inside my IDE it works well.

I use next command:

2条回答
  •  太阳男子
    2020-12-21 07:32

    It's not going to work the way you're trying to currently do it, since you need to have the native files along side the jar and point to them via the '-Djava.library.path' parameter.

    If you just want a single jar and want to avoid the hassle of the command line and native files use the JarSplice tool. JarSplice is easy to use and will automatically handle the native file stuff for you.

    1) Simply export your project (class and resources) to a jar (easier just to do it through your IDE).

    2) Then run JarSplice, add all the jars you need to the jars tab (your app jar, lwjgl.jar, and any other external jar you're using).

    3)Then on the natives tab add all the natives files (windows *.dll, linux *.so, mac *.dylib & *.jnilib).

    4)On the class tab add your main class. Then create your jar.

    You can then run this jar just by double clicking it (or if you wish via command line using 'java -jar yourapp.jar').

提交回复
热议问题