[Solved] Lwjgl.dll not found when running project (3.2 sdk with gradle)

Edit was solved by removing the gradle cache. For me on windows with the 3.2 sdk it was located at {projectDirectory}\.nb-gradle\private\cache. Just delete everything inside that folder (not the folder itself) and gradle will pull fresh files.

So, I have a project managed by gradle in the 3.2 SDK. I just tried to run my project, and the jme3 settings dialog popped up fine, but when I hit continue, I get:

Uncaught exception thrown in Thread[main,5,main]
UnsatisfiedLinkError: Failed to locate library: lwjgl.dll

I have tried clean and build, and restarting the sdk, but I can’t get past this. I have checked in my file manager and don’t see lwjgl.dll (though I do see bulletjme.dll).

Here is my build.gradle:

plugins {
    id 'java'
    id 'application'
    id 'eclipse'
    id 'maven'
    id 'groovy'
}

def assetPack = "../Assets"
description = 'Core'

sourceCompatibility = '1.8'

targetCompatibility = '1.8'

ext.jmonkeyengineVersion = '3.3.2-stable' // from jCenter

tasks.withType(JavaCompile) { // Java compile-time options:
    options.compilerArgs << '-Xdiags:verbose'
    options.compilerArgs << '-Xlint:unchecked'
    options.deprecation = true
    options.encoding = 'UTF-8'
}

tasks.withType(JavaExec) { // Java runtime options:
    args = []
    classpath sourceSets.main.runtimeClasspath
    //debug true
    enableAssertions true
    //jvmArgs '-verbose:gc'
    //jvmArgs '-Xbatch'
    jvmArgs '-Xms512m', '-Xmx512m'
    //jvmArgs '-XX:+PrintCompilation'
    //jvmArgs '-XX:+UseConcMarkSweepGC'
    jvmArgs '-XX:+UseG1GC', '-XX:MaxGCPauseMillis=10'
}

mainClassName = "engine.Launcher"
if (!hasProperty('mainClass')) {
    ext.mainClass = mainClassName
}
jar.manifest.attributes('Main-Class': mainClassName)

ant.importBuild("${assetPack}/build.xml") { antTarget ->
    'ant-' + antTarget
}
compileJava.dependsOn "ant-jar"

repositories {
    mavenLocal()
    jcenter()
    maven { url 'http://nifty-gui.sourceforge.net/nifty-maven-repo' }
    mavenCentral()
}

dependencies {
    implementation 'org.jmonkeyengine:jme3-core:' + jmonkeyengineVersion
    implementation 'org.jmonkeyengine:jme3-desktop:' + jmonkeyengineVersion
    implementation 'org.jmonkeyengine:jme3-effects:' + jmonkeyengineVersion
    //implementation 'org.jmonkeyengine:jme3-networking:' + jmonkeyengineVersion
    implementation 'org.jmonkeyengine:jme3-niftygui:' + jmonkeyengineVersion
    implementation 'org.jmonkeyengine:jme3-terrain:' + jmonkeyengineVersion

    //runtimeOnly 'org.jmonkeyengine:jme3-lwjgl:' + jmonkeyengineVersion  // LWJGL 2.x
    implementation 'org.jmonkeyengine:jme3-lwjgl3:' + jmonkeyengineVersion // LWJGL 3.x

    implementation 'com.github.stephengold:Minie:3.0.0'
    
    runtimeOnly 'org.jmonkeyengine:jme3-blender:' + jmonkeyengineVersion
    runtimeOnly 'org.jmonkeyengine:jme3-jogg:' + jmonkeyengineVersion
    runtimeOnly 'org.jmonkeyengine:jme3-plugins:' + jmonkeyengineVersion
    //runtimeOnly 'org.jmonkeyengine:jme3-testdata:3.3.2-stable'
    //runtimeOnly 'org.jmonkeyengine:jme3-testdata:3.3.0-alpha2'
    implementation 'com.google.guava:guava:30.1-jre'
    implementation 'org.slf4j:slf4j-api:1.7.13'
    implementation "com.simsilica:lemur:1.14.0"
    implementation "com.simsilica:lemur-proto:1.11.0"
    
    implementation fileTree(dir: "${assetPack}/dist", include: "*.jar")
}

// cleanup tasks
clean.dependsOn('cleanDLLs', 'cleanDyLibs', 'cleanLogs', 'cleanSOs')
task cleanDLLs(type: Delete) {
    delete fileTree(dir: '.', include: '*.dll')
}
task cleanDyLibs(type: Delete) {
    delete fileTree(dir: '.', include: '*.dylib')
}
task cleanLogs(type: Delete) {
    delete fileTree(dir: '.', include: 'hs_err_pid*.log')
}
task cleanSOs(type: Delete) {
    delete fileTree(dir: '.', include: '*.so')
}

Any help greatly appreciated!

I just looked in my projects dependencies folder, and under Runtime for Main I do see lwjgl-3.2.3-natives-windows.jar

You could try SDK 3.3, create a new Gradle jME project. Copy paste the Gradle configuration there. You now seem to have some sort of (ant) magic happening with the assets. I don’t know whether you want this or not. But seems overly complicated.

I don’t know whether it fixes your problem though… Simpler build perhaps.

I’ve wanted to try out 3.3 sdk, but I’m currently on potato internet and will be for the near future. As for the ant assets, its just a separate jme3 project for holding assets. I do that because jme3.2 sdk asset tools break when you use gradle (I’ve had a topic about it here somewhere) and it makes versioning easier for me. It works fine though (amazingly actually, my whole UI lives there), and has been there for a while with no issues

1 Like

3.2 uses netbeans 1.8 and its terrible with dependencies. I was constantly having to clear caches or refresh depends.

3.3 uses netbeans 12 and is much better with dependencies and caches. Eliminated all my problems, which were similar to the ones you seem to be hitting now. Keep in mind that netbeans 1.8 was when oracle gave java and netbeans the big F U.

You can build your project with the ide of your choice if you want and just use 3.2 sdk for assets, avoiding 3.2 headaches.

If you want to use 3.2, you may want to consider updating the 1.8 java version to the latest LTS you can. Just looked and it is JDK 8u271. I don’t think it will help with this particular problem but it will clear up others you will eventually run into.

I had to get to JDK 8u212 to stop other types of exceptions I kept running into.

That link doesn’t have any information for windows (that I saw). Is there a way to do it in the sdk?
Getting 3.3 is on my list, but my internet can’t get it done at the moment. I remembered burnbit but it looks like its been down for a while. I’ll try to torrent it some other way

Found the cache, deleted it, and gradle pulled the missing dll. Solved, thanks for the tip on the cache. If it helps anyone else, the cache for me on jme3.2 sdk (windows) is in {projectDirectory}.nb-gradle\private\cache

1 Like

Pass the argument to gradle.

--refresh-dependencies

You can do that by setting up a custom task (RMB select project->run gradle) and just passing it or if you already ran gradle, click the arrows in the output window that say re-run with different parameters when hovering over and add it there. It will stay active until you close that output window so best to just setup a new custom task.

The other suggestions are to delete the .gradle cache, which would cause everything to download again, big headache for potato. Shouldn’t need to do that. Should try refresh and see if it works.

Thanks for that tip. I already deleted the cache in haste (and it was a big headache for potato). But I’m definitely gonna set up a custom task for that now. Thank you for the help!

This may help clear up whats happening. Quick read.

https://docs.gradle.org/current/userguide/dynamic_versions.html

It goes into what happens when refreshing,

https://docs.gradle.org/current/userguide/dynamic_versions.html#sec:refreshing-dependencies

1 Like

Much appreciated!

1 Like