Tag Archives: distributing

LWJGL Exporting as JAR

By the end of this tutorial you will have learned about distributing your LWJGL program as a jar-file using JarSplice.

Creating the jar-file containing only the source files

Right click your project in Eclipse and select Export. Select Runnable JAR File and click next. Enter your preferred export location and tick “Copy required libraries … generated JAR”.

Using JarSplice to create a comprehensive jar-file (LWJGL exporting)

Download the JarSplice application here. Open this jar-file by double-clicking on it. Click “Add JARs” and add the previously exported jar-file and the exported jar-file and the library jar-files. Go to “Add Natives” and select all the LWJGL native files. Go to “Main Class” and enter the class – with package definition – containing a main method that you want to execute. Go to “Fat JAR” and select the preferred export location and name.

Testing if it works

Double-clicking on this jar-file should open up your application. If it does not, open the Command Prompt on Windows or the Terminal on Macintosh, and write “java -jar ” followed by the path to the jar-file.

Conclusion

That concludes this tutorial. Should you have any questions or remarks, I would love to see them in the comments section below.