So a little background.
I am trying to create a runtime-image for my java application by using JLink. My project uses jogamp-fat.jar, which is an automatic module. Jlink doesn't allow you to create a runtime-image if you have any automatic modules in your project. I ended up figuring out a way to convert jogamp-fat.jar to no longer be automatic by using jdeps and javac --patch-module.
This did allow me to execute JLink, and my application still ran just fine. However, when I run the .bat file created from JLink, I get "java.lang.UnsatisfiedLinkError: Can't load library: ...\ bin\natives\windows-amd64\\gluegen.dll".
I've been scratching my head for a couple weeks with this and can't figure it out. Any help would be appreciated, even if the answer is Jlink just can't be used with jogamp-fat.
Disable the automatic native library loading, put the native libraries somewhere and set the library path. The option to disable the automated native library loading is mentioned in the JOGL user's guide as far as I remember.
So I went to the user guide and added -Djogamp.gluegen.UseTempJarCache=false to my VM options within my NetBeans project. This now causes my project to break when I run it in NetBeans (before only the runtime-image created from jlink broke). It is the same can't load library: "...natives\windows-amd64\gluegen_rt.dll error as before. I've also tried setting the java.library.path within the VM options as well as while the program is running with no success... I am confused as to why when I remove -Djogamp.gluegen.UseTempJarCache=false from my VM options the application will run when executing from NetBeans. Why is it able to find the natives when I run through netbeans, but cant find it when the runtime-image is executed?
So update... I ended up resolving the can't load native library error. I did not realize that I needed to unzip the contents of the gluegen-rt-natives-windows-amd64.jar and jogl-all-natives-windows-amd64.jar. I thought I could just reference the jars without unzipping.
I'm not convinced that this has anything to do with jlink. I'm getting the same type of error in a non-imaged environment with several java installations. (openjdk-11, and AdoptOpenJDK 11 & 17)
The error persists through manually specifying java.library.path and disabling jogamp.gluegen.UseTempJarCache.
The property java.library.path is picked up and visible inside the VM, but the library loading insists on searching "working-directory"/natives/gluegen-rt-platform-suffix.
And I hate to do this to you, but after several clean and build cycles for unrelated reasons, I can no longer reproduce this issue. (I had been cleaning and building while I was seeing the issue...) I'll keep an eye on the discussion, and update you if I can manage to duplicate again.