How To: Install Zulu Embedded Java on Odroid C2 (ARM64)

I have now created a script that automatically installs Openhab2 for you on an Odroid C2 and includes setting up Java for you. It can be found here:

For those that are not familiar with the Odroid C2, it is similar to the PI3 with the advantages that it has double the ram, true 1000mbps network, and more than twice the CPU grunt. I opted to not purchase the Odroid XU4 (which is more powerful yet again) due to there being some reported issues with JVM running on the big/little cores which some people have reported and may have solved here.
https://forum.odroid.com/viewtopic.php?f=93&t=29008&p=229954&hilit=zulu#p229954

The C2 is also one of the best budget devices to run KODI on due to the devs using it for testing and it supporting H265 playback at 4K 60 FPS (Pi3 can not do h265). You can have multiples of them around your house as spare parts running KODI set top boxes. For more info see https://libreelec.wiki/

The steps below are tested to work on the ready made Ubuntu Minimal 18.04 LTS image which can be found here:
https://wiki.odroid.com/odroid-c2/odroid-c2

These steps should work on any Ubuntu/Debian system running an ARM64 processor including the XU4, but note that this will install the 32bit zulu JVM, as this is the recommended version for Openhab currently. If you see guides on how to install with apt-get, they currently do not work due to the Zulu repos reporting they do not support ARM64, hence why this is a little more involved.

dpkg --add-architecture armhf
sudo apt-get update && sudo apt-get upgrade -y
sudo apt install -y nano build-essential libc6:armhf software-properties-common
mkdir /usr/lib/jvm
wget http://cdn.azul.com/zulu-embedded/bin/zulu8.38.0.163-ca-jdk1.8.0_212-linux_aarch32hf.tar.gz
tar xvzf zulu8.38.0.163-ca-jdk1.8.0_212-linux_aarch32hf.tar.gz -C /usr/lib/jvm/
/usr/lib/jvm/zulu8.38.0.163-ca-jdk1.8.0_212-linux_aarch32hf/bin/java -version

The last line should test the java and you should get some output reporting the version. If you do continue on…

rm zulu8.38.0.163-ca-jdk1.8.0_212-linux_aarch32hf.tar.gz
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/zulu8.38.0.163-ca-jdk1.8.0_212-linux_aarch32hf/bin/java 1101
sudo update-alternatives --config java

The last line allows you to change between any installed JRE on your system, if you have more than 1 installed select the zulu, and now you can type in ‘java -version’ from any location to check the version.

To set JAVA_HOME as a variable, do the following as this method will auto change the JAVA_HOME if you change the selected java using the above command…

nano /etc/environment

add this to file and save

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::")

Type this into the shell to reload the changes and then test…

. /etc/environment
echo $JAVA_HOME

It should then report the path when you enter the last line.

After doing this you are ready to install Openhab2.

5 Likes

Just to let you know that i got the Armhf version installed via APT (which is the only one we need for OpenHAB2 by running:

dpkg --add-architecture armhf
sudo apt install -y nano build-essential libc6:armhf software-properties-common
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
sudo apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
apt install zulu-embedded:armhf

Running java -version afterwards:

root@domotica-03:/usr/share# 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)

just remember that (unfortunately) Zulu has stopped updating the repositories for zulu-embedded-8 so they will not post a newer release.

Ref: HowTo: Install Zulu Embedded Java on Raspberry Pi 3

1 Like

ok, i didn’t know that. thanks!

1 Like

@matt1 It seems that export command in /etc/environment does not really work. I get errors from karaf in system journal like this:

Jul 19 02:07:46 odroid karaf[6184]: java command not found

also when I echo $JAVA_HOME in a fresh shell (login via ssh) or after reboot it still points to /usr/lib/jvm/java-8-oracle which is still installed but I activated zulu via alternatives because java -version output the zulu vm.

Any way to fix it properly?

Open the install script in any text editor and have a look at what I use now as I always use and keep the script up to date. The java home is not important. If the java -version is correct you will find you are good to install openhab.

Another alternative if you don’t want to go this route.

  1. Install dietpi (which has excellent odroid c2 support and runs a minimal debian installation) https://dietpi.com/
  2. Select JAVA SDK/JRE as additional software during install
  3. Install Openhabian on top
2 Likes