Error initializing Java VM

Hello,

I am relatively new to Orekit and I am trying to use the Orekit Python Wrapper. I currently initialize the Java VM by using :

import orekit
vm = orekit.initVM()

Which has worked and runs perfectly in Jupyter notebook. However, when I try to run the same code in a Python file, I get the following error:

vm = orekit.initVM()
orekit.JavaError: <super: <class ‘JavaError’>, >
Java stacktrace:
java.lang.NoSuchMethodError: runFinalizersOnExit

Does anyone know what the issue is here or and/or how to fix it?

Hi @zachmiller ,

I think you should check the version of Java being used when you are running it in Python.

Warm Regards,
src6

This is the version that is running in jupyter notebook.

Java version: 1.8.0_412
JVM vendor: Azul Systems, Inc.

I can’t check what version is running in Python because the JVM won’t initialize.

My JavaHome is set to C:\Program Files\Eclipse Adoptium\jdk-17.0.16.8-hotspot\.

Hi,

From what I understand, your Jupyter Notebook is using Java 1.8, while your standalone Python script is picking up JDK 17. This version mismatch is likely causing the issue, and it could also depend on the environment from which you are running Python.

If you set your JAVA_HOME to the Java 1.8 path (the same one Jupyter uses) and ensure your PATH points to that JDK, you should be able to initialize the VM successfully in your Python script. Make sure you are checking the correct environment when doing this.

Warm regards,
src6