Tag Archives: workspace

LWJGL Workspace

Click to watch the corresponding video on YouTube.

By the end of this tutorial you will have learned how to set up the LWJGL workspace for compiling and running LWJGL programs.

Downloading the required files

Download the latest version of the LWJGL here and the latest version of the “slick_util” jar-file here. Extract the downloaded zip-file and put all the files and folders in one directory. To install Eclipse, download the “Classic” or “IDE for Java Developers” version here. Put the downloaded Eclipse folder in a directory to which you have read and write permissions (i.e. not in Program Files or Applications).

Creating a project in the LWJGL workspace

Click the Eclipse executable. Select a Workspace folder, in which all your Java projects will be stored. Go to the menu “File”, “New”, click on “Java Project” and enter a name for the LWJGL project. The project files will be stored in the previously specified workspace folder.

Adding the library files

Open the project directory containing the “src” and “bin” directories. Add a directory called “lib” containing two subsequent directories called “natives” and “jars”. The project directory should now contain the following folders.

- lib
- src
- bin
- lib/natives
- lib/jars

Move the “lwjgl.jar” and “lwjgl_util.jar” files from the extracted zip-file and the “slick_util.jar” file to the “lib/jars” directory. Move the native files applicable to the current Operating System found in the zip-file to the “lib/natives” directory.

This is how the project folder should look.

Linking the jar files and the natives

Open Eclipse. Go to the menu “File” and click “Refresh”. Right-click on the previously created Eclipse project and click on “Properties”. Go to “Java Build Path” and select the “Libraries” tab. Click “Add JARs…” and select the “slick_util.jar”, “lwjgl.jar”, and “lwjgl_util.jar files. Expand the lwjgl.jar list item and double-click “Native Library Folder Configuration”.  Write the name of your project followed by “/lib/natives” and click “OK”.

Project Properties

This is what the Java Build Path window in Eclipse should resemble. (The “slick_util” jar-file should also be there.)

Testing the configuration

To test if it actually works copy the following code into your project and run it. In the case of no exceptions and the display of a window, the configuration has been set up correctly.

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
 * If this application shows a blank and responsive window
 * and doesn't throw any errors, you know you have installed lwjgl
 * correctly.
 * @author Oskar Veerhoek
public class DisplayTest {
    public static void main(String[] args) {
        try {
            Display.setDisplayMode(new DisplayMode(640, 480));
            Display.setTitle("Episode 1 – Display Test");
        } catch (LWJGLException e) {
            System.err.println("Display wasn't initialized correctly.");
        while (!Display.isCloseRequested()) {

java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path

This exception is thrown when LWJGL cannot find the native files it needs. Perhaps the natives file path has been set up incorrectly or the native files for another Operating System were selected.


That concludes this tutorial. Should you have any questions or remarks, leave them in the comments.