An application using a JNI library which loads a library from
/usr/local/lib throws a
java.lang.UnsatisfiedLinkError like the following:
java.lang.UnsatisfiedLinkError: /path/to/lib/libfoo_java.jnilib: dlopen(/path/to/lib/libfoo_java.jnilib, 1): Library not loaded: libfoo_c.dylib Referenced from:/path/to/lib/libfoo_java.jnilib Reason: image not found at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
libfoo_c.dylib is in
/usr/local/lib, and the documentation says it should be loaded automatically, without making any changes.
Apple now requires Application executables like Java to be Notarized. As part of this process, with MacOS 10.15.3, the executables must be Hardened Runtime. In order to be Notarized, and once the Hardened Runtime executables and libraries are installed in the
/Library hierarchies, they cannot load libraries which have not been Notarized. Note that Apple has been tightening this up progressively.
In the short term, the resolution is to download the zip image of the version of Azul Zulu Builds of OpenJDK that you need, and extract the bundle to a folder outside
/System. When you want to run your application, first set
DYLD_LIBRARY_PATH=/usr/local/lib, and then use the java executable from the unzipped install. In time, as Apple extends its security model, this option may go away.
In order to ensure that your application is able to continue to load any third-party libraries in the future, contact the library authors and let them know that you need them to submit their libraries for Notarization.
the following versions and later:
|Azul Zulu Version||JDK Version|