Fixing Jitsi Java Runtime error from recent update

I have used Jitsi for years now as a fantastic self-hosted video conferencing bridge. It is excellent.

I am currently running it on a Raspberry Pi, and it works really well.

After a recent automatic update, it stopped working, and the following line was in the jvb.log file:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/jitsi/videobridge/MainKt has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Looking at the Jitsi documentation, I noted this:

OpenJDK 11 must be used.


I checked the java version on the server with java -version:

openjdk version "1.8.0_312"
OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07)
OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)

So that was probably it.

I installed OpenJDK 11:

apt install openjdk-11-jdk -y

However, the command I was expecting to use to tell the system to use OpenJDK 11 didn’t work:

sudo update-alternatives --config java export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-arm64/

Instead, I ended up using:

sudo update-alternatives --config java

And selecting OpenJDK 11 manually. I checked it with java -version:

openjdk version "11.0.15" 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1, mixed mode)

I then restarted the jitsi stack:

systemctl restart jitsi-videobridge2 prosody jicofo

And it worked again.