2
votes

Does anybody know, if JPype works with a Java 10 JRE?
I have tested JPype with Java 8 without any problems but I am not able to use it in combination with Java 10.

My test setup:

  • Windows 10 64-bit
  • Python 3.5.2 (Anaconda 4.2.0) 64-bit
  • Spyder 3.3.0
  • JPype 0.6.3 (via pip install)

I execute my Python test script in Spyder (included in Anaconda package).

Test using Java 8 (jre1.8.0_181) succeeded.
JPype JVM starts without any problems.

Test using Java 10 (jre-10.0.2) fails with this error:

RuntimeError: Unable to load DLL [C:\Program Files\Java\jre-10.0.2\bin\server\jvm.dll], error = Das angegebene Modul wurde nicht gefunden.
 at native\common\include\jp_platform_win32.h:58

I do have a german Windows version, so the part "Das angegebene Modul wurde nicht gefunden" may be translated as something like "The specified module cannot be found".

I used this Python code, to start the JVM in JPype:

import jpype

java_path = "C:\\Program Files\\Java\\jre-10.0.2\\bin\\server\\jvm.dll"
jpype.startJVM(java_path, '-ea')

Edit: Adding the whole test script

import jpype
import os

java_path = "C:\\Program Files\\Java\\jre-10.0.2\\bin\\server\\jvm.dll"
# java_path = "C:\\Program Files\\Java\\jre1.8.0_181\\bin\\server\\jvm.dll"

# print exists result to be sure the file exists
print(os.path.exists(java_path))

jpype.startJVM(java_path, '-ea')

print("it works")

If I use the Java 10 part, it does not work but if I use the Java 8 part (currently commented), it does work.
The first print command prints True in both cases.

Thank you in advance,
Markus

1
First thing, I would have checked would be if the jvm.dll that you are addressing is present in the location or not. Next, can you show the code that actually results in the RuntimeError as mentioned in "Test using Java 10 (jre-10.0.2) fails with this error"? - Naman
The file definitely exists at this location. I have copy&pasted the path from the file system into the test script and double-checked its location. The 3 lines code which I've posted in my question was the test which leads to this error. - Markus
Is JPype 32-bit by any chance? I'm just wondering if a 32-bit app is trying to load a 64-bit jvm.dll. - Alan Bateman
Both Java RE, 8 and 10, which I have used in my tests, are 64-bit. JPype works well with the Java 8 64-bit RE but doesn't work if I use the Java 10 64-bit RE. - Markus

1 Answers

2
votes

I'm using JDK 10.0.2 and jpype 0.6.3 works fine. As mentioned in the jpype documentation, the installation looks for a JVM at the path mentioned in JAVA_HOME system variable.

>>> from jpype import *
>>> getDefaultJVMPath()
'C:\\Program Files\\Java\\jdk-10.0.2\\bin\\server\\jvm.dll'

And my JAVA_HOME points to 'C:\Program Files\Java\jdk-10.0.2' which is why it is recommended in using-jpype that you start JVM this way -

startJVM(getDefaultJVMPath(), "-ea")