Pyjnius: Incompatibility with Java 9 - JRE Path changed

Created on 19 Oct 2017  路  11Comments  路  Source: kivy/pyjnius

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

bug

Most helpful comment

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 ( https://github.com/kivy/pyjnius/blob/1cbfef23fb9fcb0f15dcbfd8f4cd1fc9a54986b6/setup.py#L163 ).

All 11 comments

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 ( https://github.com/kivy/pyjnius/blob/1cbfef23fb9fcb0f15dcbfd8f4cd1fc9a54986b6/setup.py#L163 ).

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cmacdonald picture cmacdonald  路  20Comments

tom19952000 picture tom19952000  路  15Comments

stania picture stania  路  6Comments

tshirtman picture tshirtman  路  23Comments

Thrameos picture Thrameos  路  27Comments