jmonkeyengine: NativeLibraryLoader wrong libraries path

  • All the native libraries registered by default for lwjgl 2 and 3 in NativeLibraryLoader have the wrong path! (it still works for lwjgl2 and JInput because of this fallback because lwjgl2 and JInput natives are located in the root of the jar)

https://github.com/jMonkeyEngine/jmonkeyengine/blob/375015f14c5f3cbda18302b3aa990e5f023e9da1/jme3-desktop/src/main/java/com/jme3/system/NativeLibraryLoader.java#L123-L200

  • NativeLibraryLoader is never used by jme3-lwjgl3. LWJGL 3 uses its own SharedLibraryLoader so we should remove lwjgl3 libraries from there as it is misleading. Also trying to load lwjgl3 libraries via NativeLibraryLoader won’t work anyway and will produce an UnsatisfiedLinkError as it wouldn’t find the libraries because of a wrong path.
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.UnsatisfiedLinkError: The required native library 'lwjgl' was not found in the classpath via 'native/linux/liblwjgl.so'. Error message: no lwjgl in java.library.path
	at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:590)
	at jme3test.helloworld.HelloAudio.simpleInitApp(HelloAudio.java:27)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
	at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:601)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:704)
	at java.lang.Thread.run(Thread.java:750)
  • It does not register the ARM natives for macOS and Linux.

Thoughts?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21 (21 by maintainers)

Most upvoted comments

I can not see why we need to redesign it.

I don’t prefer large functions with too many blocks, there are a lot of hidden bugs in them, plus yeah the hardcorded directories and names may fail in some other places (according to the condition, the names may change or written wrongly, so you will have to go over each dependency and refactor it), I haven’t glanced the NativeLibraryLoader in details yet, give me sometime to glance it and I will reply back on what should be done from my opinion on the newly created issue, but it indeed looking at it from here, it needs a lot of work.

but i think it’s better to keep all the native libraries, as far as we can, inside one directory in the jar file, for example:

Each library puts them in a different path for example jinput and lwjgl2 put them in jar root while lwjgl3 puts them in <os>.<arch>.org.lwjgl.<libraryname> for example linux.x64.org.lwjgl.opengl.liblwjgl_opengl.so.