Issue
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)
at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java)
.
:
But libfoo_c.dylib
is in /usr/local/lib
, and the documentation says it should be loaded automatically, without making any changes.
Cause
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 /System
and /Library
hierarchies, they cannot load libraries which have not been Notarized. Note that Apple has been tightening this up progressively.
Resolution
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 /Library
and /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.
Applies to
the following versions and later:
Azul Zulu Version | JDK Version |
---|---|
13.29 (PSU) | 13.0.2 |
11.37 (PSU) | 11.0.6 |
11.36 (CPU) | 11.0.5.0.101 |
8.44 (PSU) | 8u242 |
8.43 (CPU) | 8u241 |
7.36 (PSU) | 7u252 |
7.35 (CPU) | 7u251 |
6.30 (PSU) | 6u130 |
Add Comment
Comments
Not sure which versions to download for Apple iMac desktop.On Sonoma.
Whatever way I try to download Jave I am botted out.
rexcarslake@gmail.com. NON BUSINESS email.(whatever that means?)
Kind regards
Rex Carslake
Please sign in to leave a comment.