detect JVM location on Mac using /usr/libexec/java_home

This commit is contained in:
Craig Macdonald 2020-04-08 14:49:09 +01:00
parent 68a7d9b04e
commit e6ee4fdba3
1 changed files with 9 additions and 1 deletions

View File

@ -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
@ -57,6 +57,14 @@ cdef find_java_home():
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 *:
cdef JavaVM* jvm