Troubleshooting java.lang.UnsatisfiedLinkError "Can't find dependent libraries"

Viewed 13

There are several similar questions but none of them seem to get to the core issue we're having. Please consider that before deleting this as a duplicate question!

  1. We compile a C++ DLL in Visual Studio 2022 Community on Windows 11. It depends on some other DLLs.

  2. Then, on the same machine, running a Java application that has to open that DLL, we get the UnsatisfiedLinkError exception for opening the DLL.

  3. A slight fork of the same Java app can read the same DLL on other computers. -Djava.library.path is not needed normally, so I very much doubt it is the problem for this user.

  4. the Java app is literally logging its java.library.path immediately before the error, and seems to contain all the /LIBPATH options the DLL build had.

I'm mostly a C++/Linux guy so I don't have self confidence on this, but I think that our Visual Studio project must have some /LIBPATH options that are not in the PATH environment variable. In other words, intellectually I am positive (4) above is not true. And yet we've checked it ten times each.

And yet two engineers have gone through this with a fine-tooth comb and are not seeing any /LIBPATH not in PATH.

So, Questions:

  1. Is there any other possible technical reason we should be getting this error?

  2. How can we find out which precise DLL is not being found? On Unix/Linux I'd use strace or truss to see what files the executable is trying to open, and instantly know what it's looking for and where it's looking for it. Any similar hint for Windows?

  3. Is there any place the DLL compile would be finding libraries that are not specified by /LIBPATH directives?

0 Answers
Related