How to upgrade lwjgl within IntelliJ + LibGDX

Hello! Can someone help me understand how one can upgrade to the latest version of lwjgl3? I’ve tried to follow several online guides however they all seem to be outdated. I feel like there is an easy way to do it via the gradle file, but I’m not quite sure on what I need to do. Here is the current structure of my gradle file:


buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        jcenter()
    }
    dependencies {
    }
}

allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = "Game"
        gdxVersion = '1.9.4'
        roboVMVersion = '2.2.0'
        box2DLightsVersion = '1.4'
        ashleyVersion = '1.7.0'
        aiVersion = '1.8.0'
    }

    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }
}

project(":desktop") {
    apply plugin: "java"


    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"

    }
}

project(":core") {
    apply plugin: "java"


    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
    }
}

tasks.eclipse.doLast {
    delete ".project"
}

I seem to have gotten lwjgl3 to work, but I’m not actually sure if it’s currently up to date? I’m able to create a lwjgl3 object inside of my DesktopLauncher as such:


public class DesktopLauncher {

	public static void main (String[] arg) {

		Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
		new Lwjgl3Application(new Game(), config);
       }
}

However overall I’m a little confused about lwjgl because lines such as this,


        Gdx.app.log("LOG: ", "LWJGL Version " + Version.getVersion() + " is working.");

lead to a nullpointerexception, so I’m assuming my lwjgl import isn’t actually there. Any pointers would be greatly appreciated!

stacktrace would help

you can’t… because libgdx comes with lwjgl in it…
so just use the latest libgdx and it will come with the latest compatible lwjgl

@orangepascal

You are semi-right, LibGDX do come with LWJGL in it, but technically it is possible to update the LWJGL 3 version.


compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion:@jar"

All you have to do is to add [icode]@jar[/icode] at the end of the definition. Then you can add LWJGL3 dependencies like you do on any other LWJGL application.

The only thing is that this is not at all recommended and may introduce you to bugs since LibGDX might not be written for your version of LWJGL3.

my bad! ;D