From e6ee4fdba380a55cfdb29a4eb6cb9a83a42527b1 Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Wed, 8 Apr 2020 14:49:09 +0100 Subject: [PATCH] detect JVM location on Mac using /usr/libexec/java_home --- jnius/jnius_jvm_dlopen.pxi | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jnius/jnius_jvm_dlopen.pxi b/jnius/jnius_jvm_dlopen.pxi index 34c6be4..1a9cb5b 100644 --- a/jnius/jnius_jvm_dlopen.pxi +++ b/jnius/jnius_jvm_dlopen.pxi @@ -2,7 +2,7 @@ include "config.pxi" import os from shlex import split from subprocess import check_output -from os.path import dirname, join +from os.path import dirname, join, exists from os import readlink from sys import platform from .env import get_jnius_lib_location @@ -56,6 +56,14 @@ cdef find_java_home(): except OSError: break return dirname(dirname(java)).decode('utf8') + + if platform in ('darwin'): + #its a mac + if not exists('/usr/libexec/java_home'): + return + java = check_output('/usr/libexec/java_home').strip().decode('utf8') + return java + cdef void create_jnienv() except *: