Changing JRE to OpenJDK 8

I’m trying to replace native “/usr/local/snap/jre” to “/usr/lib/jvm/java-8-openjdk-amd64/jre” on Debian Stretch and getting the next error while trying to call gpt -h:

Error: null
java.lang.ExceptionInInitializerError
	at org.esa.s2tbx.jni.EnvironmentVariables.getCurrentDirectory(EnvironmentVariables.java:15)
	at org.esa.s2tbx.dataio.gdal.activator.GDALDistributionInstaller.install(GDALDistributionInstaller.java:76)
	at org.esa.s2tbx.dataio.gdal.activator.GDALPlugInActivator.start(GDALPlugInActivator.java:22)
	at org.esa.snap.runtime.Engine.informActivators(Engine.java:222)
	at org.esa.snap.runtime.Engine.lambda$start$0(Engine.java:121)
	at org.esa.snap.runtime.Engine.runClientCode(Engine.java:189)
	at org.esa.snap.runtime.Engine.start(Engine.java:121)
	at org.esa.snap.runtime.Engine.start(Engine.java:90)
	at org.esa.snap.runtime.Launcher.run(Launcher.java:51)
	at org.esa.snap.runtime.Launcher.main(Launcher.java:31)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:65)
	at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:57)
Caused by: java.lang.NullPointerException
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
	at java.lang.Runtime.loadLibrary0(Runtime.java:871)
	at java.lang.System.loadLibrary(System.java:1124)
	at org.esa.s2tbx.jni.EnvironmentVariablesNative.<clinit>(EnvironmentVariablesNative.java:8)
	... 16 more

I have replaced native JRE in such way:

cd /usr/local/snap
mv jre jre-old
ln -s /usr/lib/jvm/java-8-openjdk-amd64/jre jre

By the moment, Debian Stretch version 9.12 image provides OpenJDK version “1.8.0_242”.

Do I miss some extra packages/libraries? Any hint is appreciated :slight_smile:

Currently SNAP 7 is not fully compatible with OpenJDK.
But SNAP 8 will be. The release is not to far away anymore.
So, for the moment you need to stick to the one which is provoded with SNAP.

Ah, I see, I’ve read that SNAP is not fully compatible with OpenJDK (but did not take it seriously). Moreover, OpenJDK itself seems not quite stable – just tried to replace SNAP’s embedded JRE with OpenJDK 8 on Ubuntu 16.04 Xenial, and the error above is no more (Ubuntu 16.04 has OpenJDK version 1.8.0_252).

It’s either OpenJDK 1.8.0_252 is ok, or Debian’s package is not. The problem seems solved for me.