LWJGL use in Maven

Jump to: navigation, search

LWJGL is available in Maven Central Repo starting with the version 2.8.0

You need to add the lwjgl dependency like this


This dependency will get you the main lwjgl.jar and the natives for Windows, Linux and Mac OSX.

The natives dependencies will have a classifier with the form "natives-${OS}" being:

  • natives-windows
  • natives-linux
  • natives-osx

You can use the mavennatives plugin to handle the natives unpacking, this plugin by default seaches for dependencies with classifier like natives-* and unpacks its content to the dir target/natives


Adding the plugin like this, will bind it to the maven generate-resources phase, you can also run it manually like "mvn nativedependencies:copy"

This maven plugin can be used with an eclipse plugin that will run it automatically and add the correct java.library.path to your eclipse run configurations but for now it only works with m2eclipse 0.12.* versions.

Example project

There is an example project that uses lwjgl from maven central, when running the "mvn package" command with that project, it will generate a zip file in the target/ dir. This zip file contains the example's main jar, the dependencies, the unpacked natives and batch files so you can run the example in windows, linux and mac.

Other Dependencies



LWJGL appletloader