HowTo: Install Zulu Embedded Java on Raspberry Pi 3

I think so. It is (currently) the recommended Java framework to run OH2 on top.

From what I understand, Zulu (standard & embedded) will remain open & free (of charge) since it is based on OpenJDK.
The pricing on their site with regards to Zulu embedded seems to be related to (optional) support plans targeting custom developments? (not sure)
Of course… you can never tell with these companies… they may change their commercial policy over night :slight_smile:

Ps: I use the devil (Oracle) and I don’t really care about their licensing since I don’t use it in a commercial/production environment :stuck_out_tongue:

After getting a new brand SD card… another stab at this…

I have used your instructions as follows:

sudo mkdir /opt/jdk/
cd /opt/jdk
sudo wget
sudo tar -xzvf zulu8.31.1.122-jdk1.8.0_181-linux_aarch64.tar.gz
sudo update-alternatives --install /usr/bin/java java /opt/jdk/zulu8.31.1.122-jdk1.8.0_181-linux_aarch64/bin/java 181
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/zulu8.31.1.122-jdk1.8.0_181-linux_aarch64/bin/javac 181
sudo rm zulu8.31.1.122-jdk1.8.0_181-linux_aarch64.tar.gz

The commands above went well; however, these:

maxg@rpi3ohv2:/opt/jdk $ sudo apt purge zulu-embedded-8
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package zulu-embedded-8
maxg@rpi3ohv2:/opt/jdk $ java -version
-bash: /usr/bin/java: cannot execute binary file: Exec format error

ended in errors.

Unfortunately I have no clue on how to solve this.
Found your other post:

… which is essentially what you posted here.
Any hints appreciated.

Just noticed the owner of the directory:

drwxr-xr-x 3 root root 4096 Nov 12 20:51 .
drwxr-xr-x 4 root root 4096 Nov 12 20:43 ..
drwxrwxr-x 9  111  122 4096 Aug  1 05:14 zulu8.31.1.122-jdk1.8.0_181-linux_aarch64

111 and 112 – never seen this, should I change this to root?!

1 Like

Sorry, should have mentioned that there’s a different version for each “architecture”, since you’re using a PI3 with a 32bit OS (the recommended) you’ll be wanting:

Despite the similarity in name, post and subject area, that’s not me. :wink:


Again, thank you for helping me out!

We have a winner.

java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (Zulu (build 1.8.0_181-b122)
OpenJDK Client VM (Zulu (build 25.181-b122, mixed mode, Evaluation)

I actually noticed that the 64-bit was wrong; removed it, including the links, and installed the 32-bit soft float package, which didn’t work either; but this one ‘hard float’ does.

To summarise the steps, which worked for me based on your post:

sudo mkdir /opt/jdk/
cd /opt/jdk
sudo wget
sudo tar -xzvf zulu8.31.1.122-jdk1.8.0_181-linux_aarch32hf.tar.gz

sudo update-alternatives --install /usr/bin/java java /opt/jdk/zulu8.31.1.122-jdk1.8.0_181-linux_aarch32hf/bin/java 181
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/zulu8.31.1.122-jdk1.8.0_181-linux_aarch32hf/bin/javac 181

sudo rm zulu8.31.1.122-jdk1.8.0_181-linux_aarch32hf.tar.gz
sudo apt purge zulu-embedded-8
java -version

Looks like you downloaded a tar.gz file that is not matching with your current architecture.

For instance, on a rpi, you will need to download ARM 64-bit tar gz file, not the regular x86 64-bit one.

No, for most Raspbian installs you need the 32-bit ARM file. Here is the link openHABian uses.

True, figured it out once I tried with the arm64 archive :slight_smile:

(btw, I wondered which 32b version to get, between hard floating point and soft floating point version … looks like getting the hf version was the recommended one since it’s the one matching your suggestion :-))

I copied the link from the OpenHABian repo. If that did not work we would know.

Thank you! with this guide I could install JAVA and openhab2 on my Raspberry Pi Zero W V1 :slight_smile: