LWJGL3 3.2.3 Failed to locate library: lwjgl.dll

Started by frozenflames, March 30, 2020, 11:20:18

Previous topic - Next topic

frozenflames

Hi, i am trying to setup LWJGL3 and have followed the instructions from "https://github.com/LWJGL/lwjgl3-wiki/wiki/1.2.-Install" , "http://wiki.lwjgl.org/wiki/Setting_Up_LWJGL_with_NetBeans.html" and "https://stackoverflow.com/questions/40806793/how-do-i-add-lwjgl-3-1-1-to-netbeans-to-use-in-a-java-project" and have searched for solutions online but nothing seems to work.

I am using win 10x64, netbeans 11.3x64, JDK 14x64. The library is setup using the above mentioned instructions. The test code is from "https://www.lwjgl.org/guide"

Following is the snapshot of the error.

run:
Hello LWJGL 3.2.3 build 13!
[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
   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 newmodule/newpackage.NewClass.init(NewClass.java:46)
   at newmodule/newpackage.NewClass.run(NewClass.java:31)
   at newmodule/newpackage.NewClass.main(NewClass.java:121)
C:\Users\waqas\AppData\Local\NetBeans\Cache\11.3\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\waqas\AppData\Local\NetBeans\Cache\11.3\executor-snippets\run.xml:40: Java returned: 1
BUILD FAILED (total time: 0 seconds)



hdonk

Hi. Looks like you haven't got the natives jar file(s) in your classpath...

frozenflames

Quote from: hdonk on March 30, 2020, 11:33:28
Hi. Looks like you haven't got the natives jar file(s) in your classpath...

I have created a natives folder with the required jars, but still get the error. I have included
-Djava.library.path="C:\Users\waqas\OneDrive\ProgrammingLibraries\LWJGL3-3.2.3\natives"
as vm options in run properties of the project and have tried altering it but no luck.

KaiHH

This documentation http://wiki.lwjgl.org/wiki/Setting_Up_LWJGL_with_NetBeans.html is for the old LWJGL 2.x version. In fact, the whole wiki.lwjgl.org (every page you find therein) only applies to the legacy LWJGL versions 2.x.

If you follow https://github.com/LWJGL/lwjgl3-wiki/wiki/1.2.-Install#netbeans to the letter (make sure to read every bullet point three times!) then it will work. Please follow this documentation to the very letter.
For example when it says:
Quote
In the Classpath tab add all .jar files from the previously downloaded .zip file, excluding those containing sources or javadoc in their name.
then this really means ALL jar files (except for sources and javadocs). So, this INCLUDES the ones with "natives" in their names.

frozenflames

Quote from: KaiHH on March 30, 2020, 12:43:25
This documentation http://wiki.lwjgl.org/wiki/Setting_Up_LWJGL_with_NetBeans.html is for the old LWJGL 2.x version. In fact, the whole wiki.lwjgl.org (every page you find therein) only applies to the legacy LWJGL versions 2.x.

If you follow https://github.com/LWJGL/lwjgl3-wiki/wiki/1.2.-Install#netbeans to the letter (make sure to read every bullet point three times!) then it will work. Please follow this documentation to the very letter.
For example when it says:
Quote
In the Classpath tab add all .jar files from the previously downloaded .zip file, excluding those containing sources or javadoc in their name.
then this really means ALL jar files (except for sources and javadocs). So, this INCLUDES the ones with "natives" in their names.

I have done that but still the same error. Check this snapshot https://ibb.co/K7FDpsV

The library is added as https://ibb.co/HHYX5yf
The vm options https://ibb.co/1fvy3tt

KaiHH

The documentation https://github.com/LWJGL/lwjgl3-wiki/wiki/1.2.-Install#netbeans never mentioned anything about adding -Djava.library.path VM arguments. So, don't do it. The natives will be loaded from the native jars in the classpath.

KaiHH

Next possible cause: You added the LWJGL library into the Modulepath. Is your application a Jigsaw (Java 9 Module System) application? You probably want to go the easier route and add it to the Classpath (instead of the Modulepath).

frozenflames

Quote from: KaiHH on March 30, 2020, 13:55:12
Next possible cause: You added the LWJGL library into the Modulepath. Is your application a Jigsaw (Java 9 Module System) application? You probably want to go the easier route and add it to the Classpath (instead of the Modulepath).

Yes my application is a modular. I right clicked on libraries in the project hierarchy and added the Lwjgl library and it worked.

But still wondering this is not the right solution, there should be a detailed installation guide for modular projects in different ides.