kivy/pyjnius

Incompatibility with Java 9 - JRE Path changed

cthoyt opened this issue · 11 comments

PyJnius looks for the path

/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/jre/lib/server/libjvm.dylib

but the jre folder doesn't exist in this hierarchy anymore and it should look for

/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/server/libjvm.dylib

Looks like this just needs a small change at https://github.com/kivy/pyjnius/blob/master/setup.py#L82 , but I'm not sure exactly what should be different (e.g. is this a new condition if framework has a certain value?). Would you be able to post the output of /usr/libexec/java_home?

I'm running Mac OS 10.13 with Java from the most recent brew cask install java.

$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home

As a side note, in the past, with the -v option, you had to do /usr/libexec/java_home -v 1.8 but now you have to do /usr/libexec/java_home -v 9. Looks like they've committed to a new versioning scheme.

Hi @inclement, I'm just coming back to this now. Was this feedback enough to make an update?

Guys, any update ?

It's not just an OSX issue if you're using open-jdk the jre folder no longer exists. Any open jdk version >= 9 no longer has the jre folder. See http://openjdk.java.net/jeps/220 since java 9 the folder hierarchy was restructured. The jre/lib/amd64/server/libjvm.so path is no longer valid (

lib_location = 'jre/lib/{}/server/libjvm.so'.format(cpu)
).

hadim commented

That bug will also affect the usage of Java >= 9 using the soon-to-be-released conda-forge builds: conda-forge/openjdk-feedstock#34, conda-forge/openjdk-feedstock#35, conda-forge/openjdk-feedstock#36

hadim commented

Fixed in #363

Pyjnius 1.1.4 requires to unset DYLD_LIBRARY_PATH with JRE 1.8 regardless if the value is correct or not. While not backwards compatible it is good not to have to care about it in the environment any more.

@rhoerbe Could you please link some official documentation/changelog why this change happened. I'm curious if it has other implications for the whole system and not Java only.

The issue occurred within the Pycharm IDE in a rather bulky project that is not suitable to isolate the issue. When creating a separate demo-repo I was unable to reproduce it.

Now I am a few commits ahead, and changed the Django-settings, and cannot reproduce the issue in my main project any more. There are a couple of combinations to test to reproduce - I gave up.

What I can describe is that downgrading pyjnius from 1.1.4 to 1.1.3 fixed the issue. However, to reproduce it there seem be other factors than JRE 1.8 and DYLD_LIBRARY_PATH.