Reputation: 501
I've imported an existing multi-module Maven project into IntelliJ. The parent project itself builds and runs fine, but I'm trying to run one of the modules (a popup viewer window) on its own. When I do, I get this error:
[LWJGL] Failed to load a library. Possible solutions:
a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
b) Add the JAR that contains the shared library to the classpath.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to locate library: lwjgl.dll
I'm not sure how to fix this, and I'm confused on how the overall project builds and runs fine, but the module has issues running. lwjgl is included in the pom.xml, so shouldn't Maven take care of this dependency?
Upvotes: 0
Views: 3061
Reputation: 501
So my problem turned out to be that I'm on a Windows computer, but the project I've been given has its pom.xml configured so only lwjgl native-macos jars are downloaded. I fixed this by editing the main pom.xml to include two separate profiles for mac vs. windows and using them in the classifier for the lwjgl dependencies.
Before I figured this out, I found a workaround by downloading the lwjgl zip from https://www.lwjgl.org/download, extracting the jar files, and storing them as a library in IntelliJ under File > Project Structure. (I followed the instructions at http://wiki.lwjgl.org/wiki/Setting_Up_LWJGL_with_IntelliJ_IDEA.html)
Upvotes: 2
Reputation: 680
From this link:
http://forum.lwjgl.org/index.php?topic=6428.0
"The lwjgl-*-natives-* jar files should be added as "Classes", not as "Native Library Locations". They must be in the classpath for LWJGL to automatically discover, extract and load them. I think that "Native Library Locations" in IntelliJ only works if it points to folder locations, with pre-extracted native libraries. It probably passes those folders as paths to -Djava.library.path. LWJGL supports this too, but it means you must extract the native libraries from the jars yourself."
Seems you have to extract them yourself..
I'm not too familiar with maven but I'd look at configuring it to set it up so this is on the class path automatically, after checking that it works by configuring it through Intellij.
Upvotes: 1