Hot questions for Using Lightweight Java Game Library in linux


I wanted to try out the new LWJGL 3 which is currently in kind of a "beta"-state. Embarrassingly I can't even get the HelloWorld example ( to run.

package org.lwjgl.glfw does not exist

is all I get.

I added the lwjgl.jar and disruptor.jar to my module dependencies, but I guess I'm missing something about the natives here. I tried adding them as a lib, as a module (which tells me it's an empty library although there are two .so files in there oO)

I tried setting the -Djava.library.path of course, no success here:


I tried invalidating caches, adding it as system lib and about everything I know. Still, the glfw package can't be found.

I'm not sure what I'm doing wrong, but I've never done this in IntelliJ 14, neither with lwjgl 3, so maybe something has completely changed here?

Any help appreciated!


Before anything else, I'm using LWJGL 3 NIGHTLY.

I've just managed to build and launch LWJGL 3's HelloWord. Does this help?


  • Add the LWJGL jars to the classpath. This is usually done by setting up a library dependency for your project and attaching jars to it.

In my case, compiling with this worked

javac -cp ../jar/disruptor.jar:../jar/lwjgl.jar: -d . *.java
  • Set the -Djava.library.path system property (as a JVM launch argument) to the appropriate path for the target OS/architecture

And actually launching the tutorial worked with this.

java -classpath ../jar/disruptor.jar:../jar/lwjgl.jar: -Djava.library.path=../native/linux/x64/ org.lwjgl.demo.glfw.HelloWord

Be sure to adjust the path if needed.

edit: I just realized you were probably asking for a solution with intellij, in which case I'm not sure if this is helpful.


I have a problem when trying to run a simple Java code to render a simple triangle using shaders. While in Windows it works nice screenshot, in Linux it isn't displaying anything but a black screen.

I am using Ubuntu 14.10 and Mesa 10.1.3, and lwjgl as the framework.

Here is the code for my main drawing function:

private static void render() {

     GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
     GL20.glVertexAttribPointer(0, 3, GL11.GL_DOUBLE, false, Vertex.BYTES, 0);

     GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, ibo);

     GL11.glDrawElements(GL11.GL_TRIANGLES, vertices.size(), GL11.GL_UNSIGNED_INT, 0);


Here is a full version of the simple code for testing purposes: code.

EDIT: After running the same code various times, one of them draw this, and I haven't been able to replicate it.


The biggest problem right now is that you have a core profile context but you are not using Vertex Array Objects. Why Windows is allowing this, is hard to say, but Linux is giving the behavior you would expect.

You are going to need to create and bind a Vertex Array Object at least one time in your software because this is a required step in writing 3.3 core profile software.

If you add this to Main.create (...), you will have compliant 3.3 core code:
int vao = GL30.glGenVertexArrays ();
GL30.glBindVertexArray (vao);


I just added lwjgl 3.1 to a project in Intellij IDEA. To verify everything was done correctly I tried to run the guide code in the webpage (, but when compiling the following error came out:

"Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.system.MemoryAccess"

After a google search I found out that the possible error is in the configuration of the native libraries, which I have added when configuring the library in the project.

When LWJGL was downloaded from the webpage, I got a a zip file with all the jar files of the modules (classes, docs, natives and sources), what I did was to separate them accordingly and then add them as a single library in the global libraries section of the IDE. Global Libraries

After this, the library appears as a module of the project.

Still, the program won't compile. Is there anything else I should configure?


You claim that this is a compile-time error, however, after looking through the documentation, I have found out that this is a runtime error, where you successfully compile, but the JVM is unable to find the class at runtime. To solve this, I would suggest merging your .jar output and the lwjgl jar using jarsplice to see if that fixes it. If it fixes it, the problem is with intelliJ not correctly adding your libraries to your jar.