Azul provides free builds of OpenJDK 11 that are fully compliant with the Java SE standard.
Follow these steps to install OpenJDK 11 on a Raspbian/Debian/Ubuntu or similar OS:
First create a directory for the JDK:
sudo mkdir /opt/jdk
cd /opt/jdk
Then you’ll need to find out the architecture of your OS:
dpkg --print-architecture
This shows you if it’s Soft Float (armsf) or Hard Float (armhf) ABI.
Go to the Azul download page and get the download link for the latest 32bit version, download it and unpack:
sudo wget http://cdn.azul.com/zulu-embedded/bin/zulu11.31.16-ca-jdk11.0.3-linux_aarch32hf.tar.gz
sudo tar -xfvz zulu11.31.16-ca-jdk11.0.3-linux_aarch32hf.tar.gz
sudo rm *.tar.gz
How let’s create a symbolic link for java and javac to point to this JDK:
sudo update-alternatives --install /usr/bin/java java /opt/jdk/zulu11.31.16-ca-jdk11.0.3-linux_aarch32hf/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/zulu11.31.16-ca-jdk11.0.3-linux_aarch32hf/bin/javac 1
You can now check if everything is set up properly:
java --version
1 comments
I got an error unpacking using tar; solution was to change the order of the arguments to -xvzf
correct call:
sudo tar -xvzf zulu11.31.16-ca-jdk11.0.3-linux_aarch32hf.tar.gz