A number of users have struggled to get snappy working in recent macOS versions by
building jpy binary wheel. One common oddity was a failure running snappy-conf
accompanied by a popup requesting installation of the legacy Java SE 6 runtime. This is a common issue for macOS users attempting to install applications that use the Java Native Interface (JNI). I recently obtained access to macOS Catalina and was able to reproduce this for SNAP 8 using:
sudo port install openjdk8-zulu
Rather than install the legacy package, I uninstalled openjdk8-zulu
and ran:
sudo port install openjdk8-zulu +JNI
For this version, /Library/Java/JavaVirtualMachines/openjdk8-zulu/Contents/Info.plist
has the section:
<key>JVMCapabilities</key>
<array>
<string>JNI</string>
<string>CommandLine</string>
</array>
The line <string>JNI</string>
was not present in the version installed without the +JNI
option.
[edit] Looking at the Portfile, installing the +JNI
variant just makes the above
edit to Info.plist
to:
Advertise the JVM capability “BundledApp”. This is required by some java-based app bundles to recognize and use the JVM.
Additional notes:
- macOS users should set
JAVA_JDK
using the value returned by
/usr/libexec/java_home
, e.g.:
export JAVA_JDK=$(/usr/libexec/java_home)
export JAVA_HOME=$JAVA_JDK
- I used
git clone https://github.com/jpy-consortium/jpy
for thejpy-0.10.0-devel
source.
Two edits were needed. I have maven3 installed asmvn3
, so editedsetup.py
to changemvn
tomvn3
and rateCC=/opt/local/bin/gcc-mp-11 /usr/bin/python3 setup.py build maven bdist_wheel
. This gave one error inorg_jpy_PyLib.c
:
% git diff src/main/c/jni/org_jpy_PyLib.c
diff --git a/src/main/c/jni/org_jpy_PyLib.c b/src/main/c/jni/org_jpy_PyLib.c
index 53cd7ef..4f62ef2 100644
--- a/src/main/c/jni/org_jpy_PyLib.c
+++ b/src/main/c/jni/org_jpy_PyLib.c
@@ -44,6 +44,7 @@ int copyPythonDictToJavaMap(JNIEnv *jenv, PyObject *pyDict, jobject jMap);
static int JPy_InitThreads = 0;
+void JPy_free(void); // fix error: implicit declaration of function 'JPy_free' is invalid in C99
//#define JPy_JNI_DEBUG 1
#define JPy_JNI_DEBUG 0