Failed launch of Java VM

Hello everyone,

I uninstalled anaconda3 on my laptop (running on Windows) and replaced it with miniconda3.
But now, I am unable to use Orekit, as I get the following trace when calling orekit.initVM():

 orekit.initVM()
orekit.JavaError: <super: <class 'JavaError'>, <JavaError object>>
    Java stacktrace:
java.lang.NoSuchMethodError: runFinalizersOnExit

I’ve already tried downgrading to orekit 11.2 and python 3.10, to no avail.
Will now try updating conda and let you know. Meanwhile, if any of you has already seen this and solved it, please share!
Edit: nope, conda update didn’t do the trick, I’m out of ideas…

Cheers,
Romain.

I believe this is the same problem reported here by @Swagata
Could this be due to recent conda shenanigans @petrus.hyvonen ?
Edit: I forgot to mention that I also upgraded my Pycharm to 2023.1.2

Hi Romain,

I don’t recognize that error. There is some warning on finalizers (that JCC uses) and that it is to be depricated. Maybe you are using a more recent version of java than the v8 that the conda package typically uses? Or that the envorionment isn’t activated and it is accessing some default java. Just a guess.

If you are using pycharm, install the conda-wrappers package and set in pycharm the interpreter to the one in … tools/wrappers/conda/python (I think) and the environment is activated automatically when running from pycharm.

Orekit works with miniconda, maybe also check your .condarc that the packages are not still fetched from anaconda’s repositories, I don’t recommend to mix, so remove any “default” (which is anaconda) or anaconda channels from that.

Hi @petrus.hyvonen,

thank you for your swift reply. I think the conda env is activated properly and as for the .condarc file, I deleted it recently.
So I’ve tried both using micromamba and running in terminal rather than within IDE, only to get the same error. Maybe it is indeed trying to use the wrong Java. I have JDK11 installed which is used to compile the Java version of Orekit (and Hipparchus). But I’ve never had problems before, the Python stuff was running the wrapper smoothly… How can I enforce things?

Romain.

Hm. not sure what it could be. I woudl probably remove all conda, miniconda, anaconda stuff (also in AppData dir on windows) and start over again.

I tried on my windows 10 machine a “conda create -n orekit2 orekit”
followed by conda activate orekit2
import orekit; orekit.initVM() works and gives an jcc.JCCEnv object

The variables that are important under windows are JCC_JDK (points to the jvm/jdk), and PATH, see the activation scripts, you could check that these are ok but they should really be if you have activated your enviroment.

Thanks for your link Petrus. I just created an environment variable for the JCC_JDK pointing in my mamba env (where Library is). Ugly but it works!!!
So by itself it must have been struggling to find it, perhaps because I uninstalled some stuff in a rather unorthodox way. This is all dark magic to me. Anyhow I’m not planning on using this particular laptop for much longer, so that will do.

Cheers,
Romain.

Ok good it solved and good to get it documented that still there may be issues with the JCC_JDK variable :slight_smile: Yes there many factors involved, that’s why I thought conda was a good idea but still… :slight_smile:

Hey, I had the same problem. The variables were not being set when the conda environment was activated. I believe that the problem for me was that I was using PowerShell and the activate.bat script is inteded to work with cmd.

I managed to fix this by creating .ps1 scripts from activate.bat and deactivate.bat. Maybe this will work for you too. Here are them:

orekit-activate.ps1 (247 Bytes)
orekit-deactivate.ps1 (263 Bytes)

Here are the files that should be added to $Env:CONDA_PREFIX\etc\conda\activate.d and $Env:CONDA_PREFIX\etc\conda\deactivate.d, respectively.

1 Like

Many thanks @giorgio for your contribution of these scripts to the conda-forge package! These are now installed by default.

1 Like