Install Zulu Java 11 in order to run openHAB 3 on Raspberry Pi 4

I’ve been struggling to install Zulu Java 11 and I’ve searched everywhere and cannot find a solution. I assumed it would be simple :grimacing:

I have a manual install of openhab 3 on a raspberry pi 4.

I was hoping I could just apt-get install zulu-11 …

Anyway I tried to find the package and install manually but that did not work. If anyone knows of a solution or can point me to one that would be great thanks.

#go to folder

wget -c

sudo tar -xzvf zulu11.43.100-ca-jdk11.0.9.1-linux_aarch64.tar.gz

#create alternative
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/zulu11.43.100-ca-jdk11.0.9.1-linux_aarch64/bin/java 100

#update to new alternative
sudo update-alternatives --config java

#check version
java -version

I just get an error and nothing works

-bash: /usr/bin/java: cannot execute binary file: Exec format error

What is the output of these two commands:

uname -a
file -L /usr/bin/java

Why don’t you install openHABian and let it take care of Java ?

I have a custom setup script which I prefer to use and manage.

Out of curiosity can you install openHABian after you have installed everything manually? I’ve already updated openhab to version 3 so in theory updating java should be all I need for now.

Linux pi 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux

/usr/bin/java: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/, for GNU/Linux 3.7.0, BuildID[sha1]=712a17499fc9a0238477574fa013cf68667ecca5, not stripped


openHABian works because it has a well defined starting point … but that you have changed so how am I supposed to know ? Cherry picking doesn’t work.

Thanks for getting back to me. As I expected it’s probably too late to install. It’s an openHAB instance that I installed before openHABian was available and it has many customisations and openhab items etc. This is why I just want to understand how to install Zulu Java 11 and nothing else. I cannot afford to start from scratch.

openHABian doesn’t change anything about openHAB.
You can import your openHAB backup into a fresh openHABian install.

Ah that’s good to know! I’ll give that a go. Thanks for that.

Still interested to know how to just update Java to 11 though as I have other items that are not included in the openhab backup script that are a pain to move over and re-configure.

My VPN, InfluxDB, Grafana, etc etc

So you have no system level backup ? You really should start over and start right here.

You downloaded the package for a wrong architecture.


Yes I usually do an image of my SD card. Looks like what you showed me would be a better way though with added benefits.

Sorry I thought ARM 64-bit was correct, that link is the only one I could find for version 11

ahh tried the 32bit version and it works, thanks

wget -c

In the meantime you received an answer.
Explanation for the output of the uname / file commands:

Linux pi 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux

the installed OS supports armv7l which is 32 bit.

usr/bin/java: ELF 64-bit LSB shared object, ARM aarch64,

This is why the java binary ( aarch64 ) does not run.

1 Like

Just summarizing since i was looking for ages (at least one weekend) to find out the right answer howto install java 11 zulu

#go to folder

sudo wget

sudo tar -xzvf zulu11.43.88-ca-jdk11.0.9-linux_aarch32hf.tar.gz

#create alternative
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/zulu11.43.88-ca-jdk11.0.9-linux_aarch32hf/bin/java 100

#update to new alternative – select new java version
sudo update-alternatives --config java

#check version
java -version

hey guys I received this error and I am stuck,
error: alternative path /usr/lib/jvm/zulu11.43.100-ca-jdk11.0.9.1-linux_aarch64/bin/java doesn’t exist
why it didn’t create the forlder during the unpaking?

How and where did you unpack it ? In case you used openhabian-config to download java it is not unpacked into /usr/lib/jvm/zulu11*

Hi all,
i hope it’s okay if I add this rather general question here, but from my point of view it fits best here.
It is probably a stupid question: but is it mandatory to stop the openhab service before a java update, or does it not matter? To be on the safe side, I would definitely do that, but so far I haven’t found a hint about it in the forums and on other websites. I only ask because I want to better understand the connections between Openhab and Java. I am not using Openhabian, but an installation of Openhab (3.1.1) on Raspberry Pi OS (Debian buster/oldstable).

Thanks a lot!

Have a look at files - How is it possible to do a live update while a program is running? - Unix & Linux Stack Exchange. That links explains how für System Handels auch upgrades/updates.

Yes, I think that helps me. Thank you! So if I understand correctly, I can install the Java version in parallel without stopping the openHAB service, but at the latest when I switch to the new Java version (sudo update-alternatives --config java) I have to restart the service afterwards so that it also uses the new version, correct?

Thank you very much.