Setting Up LWJGL with IntelliJ IDEA
From LWJGL
This tutorial will run you through the steps you'll need to get LWJGL setup with the Intellij IDEA IDE.
First create a new project.
To have something to verify that the libraries are loaded correctly both at compile and runtime we can add some simple code that uses LWJGL
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
public class Main {
public Main(){
try {
Display.setDisplayMode(new DisplayMode(800, 600));
} catch (LWJGLException e) {
e.printStackTrace();
}
}
public static void main(String[] args){
new Main();
}
}
Then we add the needed jar files.
We are now able to successfully build the code, but if you try to run it you will get an error saying:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
This happens because the native libraries are not known. This can be fixed by creating a new folder inside the project called 'lib' and copy the correct folder from the native folder within lwjgl (depending on your operative system). This folder must then be passed to the JVM as an argument when running the program. To do this, open the run configuration:
Note: You should run your application before doing this, unless you want to add the JVM argument globally. From the screenshot you can see that I only added the argument to the configuration for the class containing my main method.
After doing this you should be able to run the application without any errors :)


