Hot questions for Using Lightweight Java Game Library in gradle


I'm new to gradle and I'm trying to configure gradle with lwjgl3. Because I didn't found a repo where lwjgl3 is hosted i decided that everybody who use this project has to define the path to the lwjgl lib. I created a user.gradle file with contains the paths to the jar and to the natives.

My build.gradle looks like this at the moment.

apply plugin: 'java'
apply from: 'user.gradle'
apply plugin: 'application'

sourceCompatibility = 1.8
targetCompatibility = 1.8

mainClassName = "mp.Main"

println("LWJGL jar path is configured to: ${config.lwjgl3Jar}")
println("LWJGL natives path is configured to: ${config.lwjgl3Natives}")

repositories {
    flatDir {
        dir config.lwjgl3Jar

dependencies {
    compile ''
    compile ''
    testCompile 'junit:junit:4.+'
    testCompile 'com.carrotsearch:junit-benchmarks:0.7.2'
    compile name: 'lwjgl'

tasks.withType(Test) {
    scanForTestClasses = false
    include "**/*Test.class" // whatever Ant pattern matches your test class files

    main {
        java {
            srcDir 'src'
            exclude 'mp/graphics/gl/scene/'
            exclude 'test'

        java {
            srcDir 'src/test'
            exclude '**/'
            exclude '**/DispatchTests/*'
            exclude '**/'
            exclude '**/'
            exclude '**/'
            exclude '**/'

task wrapper(type: Wrapper) {
    gradleVersion = '2.3'

How to set the natives? I tried it different ways. Google didn't helped me out this time. All results are related to older versions of this lib and all are using repositories. Maybe I'm missing the forest for the trees in between. Any ideas?

Best regards!

PS: Not sure if it is important: We are using different IDE's like intelliJ and Eclipse on Windows, Linux, and Mac.


I have run into the same problem and wrote a plugin for handling the natives associated with Java jar files.

It will unpack them from the jar files so that you can use them and deploy them in your project.


I'm having issues getting my IDEA IntelliJ workspace to work with a Gradle script that should setup LWJGL and other libs automatically. The script does setup the workspace and everything compiles without issues. The problem is when running my code I get missing a missing .dll error.

Log of error: build script:

Checking the folder the code outputs the .dll shows the file is missing. The problem is that LWJGL should auto extra .dlls according to the site.

In short, I have no clue what I'm doing and could use help getting LWJGL setup. As well I have googled setup instructions, watched videos, and searched for error help. Everything is either not related or outdated for the current version.


Not sure if LWGL 3.1.1 includes libGLESv2.dll and its companion libEGL.dll.

If they were not provided by LWJGL you can use the PowerVR SDK GLES emulator, which runs on top of your native OpenGL.

Another option is Google's ANGLE, wich runs on top of DirectX 9 and/or DirectX 11. Angle is lighting fast and runs very well on low end GPUs -I mean notebooks with Intel GPU-. If you are in hurry or would like to skip compiling ANGLE from sources, just go to your Chrome web browser install folder and look for libegl.dll, libglesv2.dll and d3dcompiler_47.dll.

Once you already choosed your OpenGL ES emulator, put above files in your PATH and/or java.classpath and be happy. In your case, seems the native path is set at org.lwjgl.librarypath and assigned to folder C:\Users\Rober\AppData\Local\Temp\lwjglRober\3.1.1-build-16.


I'm following this tutorial ( But in step 18 where I run the project as a java application, I get the following errors:

I've tried looking around but found no solution for the errors i had.

Any ideas?


Running a java --version returns

openjdk 11.0.4 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)

My libgdx version is 1.9.10 which i think is the newest?


What version of libgdx and java are you using?

For the error check this question

Like you the questioner used libgdx under ubuntu with a newer version of the open jdk.Downgrading to version 8 seemed to have resolved that issue.

The warnings basically says something along the lines that the underlying code uses functionality that has been deprecated and is pending for removal. Using a newer version of libgdx might solves that issue.

However some of those issues might not be resolved as libgdx does not seem to be under (much) active development anymore. The usual recommondetation is to not use anything beyond JDK 8.

According to the repo (for example this) 1.9.10 is indeed the latest version.

Note as well that those are just warnings you could potentially igore. However as your are facing other issues with the open-jdk implementation ignoring them is not an option for you.