Which Java 21 Version is Recommended for openHAB5.x?

Here’s a refined post focusing specifically on which version of Java 21 to use:


Title: Which Java 21 Version is Recommended for openHAB?

Hi everyone,

I’m exploring the use of Java 21 with openHAB and wanted to ask the community and maintainers about the best choice:

  1. Is there a specific Java 21 distribution (e.g., Oracle JDK, OpenJDK, Temurin, etc.) that works best with openHAB?
  2. Are there any known issues or limitations with certain Java 21 builds?
  3. Is the openHAB team recommending a specific update version within Java 21 (e.g., 21.0.1 or newer)?

I’m currently on openHAB 4.x but also preparing for openHAB 5.x, where Java 21 will be required. Any guidance to ensure compatibility and stability would be greatly appreciated.

Thanks in advance for your advice!

It might depend on your OS distribution and availability.
As far as I understood, openJDK21 is not in the repositorys for arm64.
I also had to add a beta repo to my new debian12 VM to be able to install openJDK21.

So no, there is no prefernce AFAIK.

I am using Zulu OpenJDK 21 with my OpenHAB 4.2.3 since few Month - works fine

1 Like

In case someone wants to install GraalVM JDK 21 I created a simple script to automate installation on a Pi as it is not available as an APT package:

#!/usr/bin/bash
echo "Installing GraalVM JDK 21"
jdk="graalvm-jdk-21_linux-aarch64_bin.tar.gz"
javahome="/usr/lib/jvm/graalvm-jdk-21"

mkdir -p $javahome/
wget -O /home/$(logname)/$jdk https://download.oracle.com/graalvm/21/latest/$jdk
tar -xzf $jdk -C $javahome --strip-components 1

sudo update-alternatives --install "/usr/bin/java" "java" "$javahome/bin/java" 1111
sudo update-alternatives --install "/usr/bin/javac" "javac" "$javahome/bin/javac" 1111
sudo update-alternatives --set java $javahome/bin/java
sudo update-alternatives --set javac $javahome/bin/javac

Please check if java home directory applies to you first.

1 Like

Bellsoft Liberica JDK has excellent ARM support, even JDK 23 for ARM 32 bit.

I’m running OpenHAB 4.0.2 on Liberica JDK 23 on ARM 32 without any issue. Unfortunately with OpenHAB 5 I must replace this hardware.

But keep in mind you are running an unsupported Java version. Even it might work, we only support LTS versions.

1 Like