Hello Guest

Unable to locate library liblwjgl.so in intellij IDEA

  • 6 Replies
  • 1575 Views
Unable to locate library liblwjgl.so in intellij IDEA
« on: January 03, 2020, 07:41:16 »
I'm getting the following error. When starting a project in Intellij IDEA.

Code: [Select]
[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.
Stopping due to fatal error!
Successfully Wrote Crash Report!
java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.so
at org.lwjgl/org.lwjgl.system.Library.loadSystem(Library.java:162)
at org.lwjgl/org.lwjgl.system.Library.loadSystem(Library.java:62)
at org.lwjgl/org.lwjgl.system.Library.<clinit>(Library.java:50)
at org.lwjgl.glfw/org.lwjgl.glfw.GLFW.<clinit>(GLFW.java:674)

I have tried following https://www.youtube.com/watch?v=ZR9hNrnT2QE and https://github.com/LWJGL/lwjgl3-wiki/wiki/1.2.-Install under the "IntelliJ IDEA" subheader. Neither have worked and have given me that error message. I have also tried putting "-Dorg.lwjgl.util.DebugLoader=true" in the program arguments. But it seems to not give me any extra information. In eclipse I would fix this issue by adding the *natives*.jar files into the classpath section. But I don't think I am able to do that in intellij.

Also as expected both of the following lines return null.

Code: [Select]
System.out.println(Library.class.getResource("lwjgl.dll"));
System.out.println(Library.class.getClassLoader().getResource("lwjgl.dll"));

What can I do to fix this?

*

Offline KaiHH

  • ****
  • 288
Re: Unable to locate library liblwjgl.so in intellij IDEA
« Reply #1 on: January 03, 2020, 12:34:15 »
-Dorg.lwjgl.util.DebugLoader=true is not meant to be used as a program argument to be received by your own program in the String[] args array of the main method.
Instead, it is meant (like all "-D" arguments) as a JVM argument. So, in IntelliJ IDEA you do not set this in the "Program Arguments:" edit field, but in the "VM options:" field.

Re: Unable to locate library liblwjgl.so in intellij IDEA
« Reply #2 on: January 03, 2020, 21:27:14 »
I tried putting it in the program arguments. It still doesn't appear to be working for some reason.

However Configuration.DEBUG.set(true); does work:

This stuff appears at the top now:
Code: [Select]
[LWJGL] Version: 3.2.3 build 13
[LWJGL] OS: Linux v5.3.0-24-generic
[LWJGL] JRE: 13 amd64
[LWJGL] JVM: OpenJDK 64-Bit Server VM v13+33-Ubuntu-1 by Private Build
[LWJGL] Loading JNI library: lwjgl
[LWJGL] Module: org.lwjgl
[LWJGL] linux/x64/org/lwjgl/liblwjgl.so not found in java.library.path=/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
[LWJGL] liblwjgl.so not found in java.library.path

Re: Unable to locate library liblwjgl.so in intellij IDEA
« Reply #3 on: January 29, 2020, 15:30:49 »
I am experiencing the same issue, I think, after going making my project modular (java 9 modules). I'm also using IntelliJ IDEA. I have all the jars added as a library, and this worked just fine until I switched to java modules.

I get the output below.

Code: [Select]
"C:\Program Files\Java\jdk-13.0.2\bin\java.exe" -Dorg.lwjgl.util.DebugAllocator=true -Dorg.lwjgl.util.Debug=true --enable-preview "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.2\lib\idea_rt.jar=62427:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.2\bin" -Dfile.encoding=UTF-8 -p D:\OneDrive\workspace_intellij\3dgame\out\production\yt.hydrozoa.threedgame;D:\OneDrive\workspace_intellij\3dgame\out\production\yt.hydrozoa.engine;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-stb.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-glfw.jar;D:\OneDrive\workspace_intellij\3dgame\lib\joml-1.9.20.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-assimp.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-openal.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-opengl.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-javadoc.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-sources.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-stb-javadoc.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-stb-sources.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-glfw-javadoc.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-glfw-sources.jar;D:\OneDrive\workspace_intellij\3dgame\lib\joml-1.9.20-javadoc.jar;D:\OneDrive\workspace_intellij\3dgame\lib\joml-1.9.20-sources.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-assimp-javadoc.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-assimp-sources.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-openal-javadoc.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-openal-sources.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-opengl-javadoc.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-opengl-sources.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-natives-windows.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-stb-natives-windows.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-glfw-natives-windows.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-assimp-natives-windows.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-openal-natives-windows.jar;D:\OneDrive\workspace_intellij\3dgame\lib\lwjgl-opengl-natives-windows.jar -m yt.hydrozoa.threedgame/yt.hydrozoa.threedgame.Main
LWJGL v3.2.3 build 13
[LWJGL] Version: 3.2.3 build 13
[LWJGL] OS: Windows 10 v10.0
[LWJGL] JRE: 13.0.2 amd64
[LWJGL] JVM: OpenJDK 64-Bit Server VM v13.0.2+8 by Oracle Corporation
[LWJGL] Loading JNI library: lwjgl
[LWJGL] Module: org.lwjgl
[LWJGL] windows/x64/org/lwjgl/lwjgl.dll not found in java.library.path=C:\Program Files\Java\jdk-13.0.2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\Programmer\mysql-8.0.13-winx64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\Geth;C:\Program Files\ethminer-0.15.0.dev7-Windows\bin;C:\Program Files\Java\jdk-10.0.1\bin;D:\Programmer\Quicktime\QTSystem\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\Programmer\WinSCP\;C:\Program Files\kotlinc\bin;C:\Program Files (x86)\ClockworkMod\Universal Adb Driver;C:\Go\bin;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Programmer\caddy_v0.11.1_windows_amd64_personal;C:\Program Files\PuTTY\;D:\Programmer\7-Zip;C:\Program Files\Java\jdk1.8.0_171\bin;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\madsh\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\madsh\gocode\bin;D:\cygwin64\bin;;.
[LWJGL] lwjgl.dll not found in java.library.path
[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.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to locate library: lwjgl.dll
at org.lwjgl/org.lwjgl.system.Library.loadSystem(Library.java:162)
at org.lwjgl/org.lwjgl.system.Library.loadSystem(Library.java:62)
at org.lwjgl/org.lwjgl.system.Library.<clinit>(Library.java:50)
at org.lwjgl/org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:97)
at org.lwjgl/org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:67)
at org.lwjgl/org.lwjgl.system.Callback.<clinit>(Callback.java:41)
at yt.hydrozoa.threedgame/yt.hydrozoa.threedgame.Main.init(Main.java:94)
at yt.hydrozoa.threedgame/yt.hydrozoa.threedgame.Main.run(Main.java:78)
at yt.hydrozoa.threedgame/yt.hydrozoa.threedgame.Main.main(Main.java:225)

Process finished with exit code 1

I fixed this by adding a new folder "natives/" to the root of my intelliJ IDEA project, and extracting the natives in there manually. Then I added -Dorg.lwjgl.librarypath="../natives/" to my run configuration for my java module. The reason it jumps up one level before going to the natives-directory is because I make the module path the root when running.

Re: Unable to locate library liblwjgl.so in intellij IDEA
« Reply #4 on: April 08, 2020, 07:40:22 »
Is there an actual way to fix this?

The project works fine on my work PC. I brought it home because of Corona, and it gives me this error even though I changed nothing.

Is it some setting in Idea that I need to check?


*

Offline elect

  • *
  • 20
Re: Unable to locate library liblwjgl.so in intellij IDEA
« Reply #6 on: April 08, 2020, 08:05:16 »
I cloned all the lwjgl samples in a work-out-of-the-box repo here

You can use it as a base to build up your project