HowTo: Install Zulu Embedded Java on Raspberry Pi 3

This was already discussed in length and you can find the details here: http://docs.openhab.org/installation/index.html#prerequisites :wink:

Oops… sorry, I’ll take a look! :sweat_smile:

I didn’t see a clear benefit of Zulu over Oracle JDK in that link - were there some sort of performance stats in favour of Zulu over Oracle JDK on ARM?

To clarify, you can still use Oracle Java. It’s just the official recommendation by the openHAB maintainers. Let me quote what was previously said by @Kai:

The main reason is that there are “no license fees or field of use restrictions”.
Oracle JDK is (at lease on embedded systems) always subject to certain restrictions. You are actually only allowed to use it for development, but not for production. And a “pure” openHAB user probably does not really qualify as doing active development work. See https://blog.takipi.com/running-java-on-docker-youre-breaking-the-law

Besides that, we have done performance comparisons and there are no measurable differences (to the better or the worse). In the end, there was no downside to use and recommend a open source / free Java runtime, which is by the way also easier to install (looking at the soon to be available repository for arm).

1 Like

Dear Thom,

I must say that you are right: Oracle asks for money for each and every embedded device legally (or not) sold. The free Java runtime available is I must say (after all the missing sleep nights) a very good alternative for DIY solutions.
Not to be confusing to the openhab users: it does not in any way influence your openhab experience!

Best regards,

George

i think you can add zulu through repos, check my post here:

That is correct. openHABian does the same thing (see here)
@Dim would you please update your article?

1 Like

@ThomDietrich Done :sunglasses:

1 Like

Hi all. Where does Zulu put the preferences go that would normally be in ~/.java/.userPrefs ? I need to delete mine to reset my ecobee authorization, but that directory isn’t there.

Sorry to resurrect this thread, but it was the only one I could find that explains how to install Zulu on a RPi3. Since it seems a lot of people are having issues getting the OpenHABian image to work (myself included), I decided to just start from scratch with the manual Raspbian install, but I couldn’t figure out how to install Zulu without this thread.

I just wanted to add that Raspbian Stretch has deprecated use of dirmngr, which is necessary for the apt-key command, so if you are running Stretch, you will need to install this package anyway with sudo apt-get install dirmngr before importing the public key. It is unknown if this is the “correct” way of doing it, but it seems to be the easiest workaround. You can read more about it here.

Hopefully this helps someone else who is also having trouble getting off the ground with OpenHAB.

1 Like

It looks like those from Debian wouldn’t recommend using apt-key add, as they now recommend adding a key to /etc/apt/trusted.gpg.d instead (see man apt-key). To do this for Zulu, you can use the following command (first line). I’ve added the command to add the zulu repository just for easy reference:

wget -q -O - http://repos.azulsystems.com/RPM-GPG-KEY-azulsystems | sudo tee /etc/apt/trusted.gpg.d/zulu.asc
echo 'deb http://repos.azulsystems.com/debian stable main' > /etc/apt/sources.list.d/zulu.list

As a result, you shouldn’t need to install dirmngr.

2 Likes

Have you checked whether you have internet access from your PI? I just did an install now (after installing dirmngr)

Greetings

I am doing research on performance

You said

Blockquote Besides that, we have done performance comparisons and there are no measurable differences (to the better or the worse).

Do you have published data on these tests so they can be reproduced?

Thanks

I tried the installation of Zulu Embedded on my RPI 2 using the method described here.
The installation succeeded but I am just surprised to get an old version:

java -version
openjdk version "1.8.0_152"
OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, mixed mode, Evaluation)

Why a version 8u152 while the last version is apparently 8u181 ?

Edit: after an update of my uuid and secret files, connection to openHAB Cloud service is OK.

I found the repo method did not work on ARM64 Ubuntu, so I had to use the manual method of installation. I posted how here. If you want the newer version give it a go after taking a backup. Have not tried to do it this way for the PI…

Installed a new Stretch Lite on a Raspberry Pi3, and then tried to install Zulu…

wget -q -O - http://repos.azulsystems.com/RPM-GPG-KEY-azulsystems | sudo tee /etc/apt/trusted.gpg.d/zulu.asc

this was successful. Next, wasn’t…

sudo echo 'deb http://repos.azulsystems.com/debian stable main' > /etc/apt/sources.list.d/zulu.list
-bash: /etc/apt/sources.list.d/zulu.list: Permission denied

I created the file manually:

sudo nano /etc/apt/sources.list.d/zulu.list

… this was successful too.

Updating the repository failed with:

sudo apt-get update
Hit:1 http://archive.raspberrypi.org/debian stretch InRelease
Ign:2 http://repos.azulsystems.com/debian stable InRelease
Get:3 http://repos.azulsystems.com/debian stable Release [8,604 B]
Get:4 http://repos.azulsystems.com/debian stable Release.gpg [819 B]
Ign:4 http://repos.azulsystems.com/debian stable Release.gpg
Get:5 http://repos.azulsystems.com/debian stable/main armhf Packages [1,623 B]
Get:6 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
Fetched 26.0 kB in 2s (9,495 B/s)
Reading package lists... Done
W: GPG error: http://repos.azulsystems.com/debian stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B1998361219BD9C9
W: The repository 'http://repos.azulsystems.com/debian stable Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Now I am stuck.
Any hints appreciated.

Links in this How-To to the Zulu docs are 404s.

try:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9

and then apt-get update

http://docs.azul.com/zulu/zuludocs/#ZuluUserGuide/PrepareZuluPlatform/AttachAPTRepositoryUbuntuOrDebianSys.htm

I wouldn’t recommend the use of the Zulu repo for installations of Zulu Embedded. It appears to be out of date and the latest version available is below the one recommended by openHAB.

I haven’t used Zulu for a while…

is there another source (repo) available for zulu-embedded-8 packages?

I don’t believe so, instead one would have to download the <zulu_package>.tar.gz file from the website:

sudo mkdir /opt/jdk/
cd /opt/jdk
sudo wget <.tar.gz_download_link>
sudo tar -xzvf <zulu_package>.tar.gz
sudo update-alternatives --install /usr/bin/java java /opt/jdk/<zulu_package>/bin/java <priority>
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/<zulu_package>/bin/javac <priority>
sudo rm <zulu_package>.tar.gz
sudo apt purge zulu-embedded-8

Where <priority> is any integer number usually representing the version you’re downloading.

If there are multiple versions installed. You can select between them with:

sudo update-alternatives --config java
sudo update-alternatives --config javac

@mstormi has created a PR so that this can be done in openHABian.

2 Likes