Ornella
Ornella

Reputation: 31

jpype.getDefaultJVMPath() fails when I try accessing JVM from python3

I am currently using Python3, java8, jpype 0.6.3 version on windows10. jpype.getDefaultJVMPath() fails with an error :

raise JVMNotFoundException("No JVM shared library file ({0}) "
jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.

My JAVA_HOME points to C:\Program Files (x86)\Java\jdk1.8.0_241

If I try starting JVM directly by passing the jvm.dll path("C:\Program Files (x86)\Java\jdk1.8.0_241\jre\bin\client\jvm.dll) python program crashes. I have already given executable permission to .dll file

Could anyone please help me fix this issue for the above system specifications

Upvotes: 3

Views: 8845

Answers (3)

ayman2011a
ayman2011a

Reputation: 13

from jpype import *
startJVM("/home/user_name/Downloads/ideaIC-2022.2.3/idea-IC- 222.4345.14/jbr/lib/server/libjvm.so", "-ea")

java.lang.System.out.println("hello world")
shutdownJVM()

This works for me set the path manually

startJVM("/home/user_name/Downloads/ideaIC-2022.2.3/idea-IC- 222.4345.14/jbr/lib/server/libjvm.so", "-ea")

If this path is not correct for you Search for this file libjvm.so inside partition computer on linux Then copy the file path

Upvotes: 0

struggleBus
struggleBus

Reputation: 365

It turns out that the shared code I was using required a specific version of one of the drivers. I still don't understand it all enough to explain why that was but with the older driver version (from a colleague) everything works!

Upvotes: 0

Karl Nelson
Karl Nelson

Reputation: 356

It is possible that your JVM architecture (32 bit) does not match your Python (64 bit). This would cause the symptoms you are describing.

Upvotes: 2

Related Questions