Link to libjli, not libjvm, on macOS

When linking to Java on a macOS system without Apple Java 6 installed,
an error is given when attempting to load Java via JNI:

    No Java runtime present, requesting install.

And a dialog box appears saying "You need to install the legacy Java SE
6 runtime." Unfortunately, this is no longer possible on current
versions of macOS.

Linking to libjli sidesteps the issue, avoiding Apple's overzealous
linkage check, while still allowing access to Java's native API.
This commit is contained in:
Curtis Rueden 2019-09-10 13:25:56 -05:00
parent 6553ad4409
commit ad5635686c
1 changed files with 2 additions and 2 deletions

View File

@ -125,7 +125,7 @@ elif PLATFORM == 'darwin':
)
)]
else:
LIB_LOCATION = 'jre/lib/server/libjvm.dylib'
LIB_LOCATION = 'jre/lib/jli/libjli.dylib'
# We want to favor Java installation declaring JAVA_HOME
if getenv('JAVA_HOME'):
@ -136,7 +136,7 @@ elif PLATFORM == 'darwin':
if not exists(FULL_LIB_LOCATION):
# In that case, the Java version is very likely >=9.
# So we need to modify the `libjvm.so` path.
LIB_LOCATION = 'lib/server/libjvm.dylib'
LIB_LOCATION = 'lib/jli/libjli.dylib'
INCLUDE_DIRS = [
'{0}/include'.format(FRAMEWORK),