I am trying to install the ARM64 version of Java on my Raspberry Pi model 4.
I have already added arm_64bit=1
to the /boot/config.txt
file and running uname -a
returns Linux pi4 5.10.17-v8+ #1403 SMP PREEMPT Mon Feb 22 11:37:54 GMT 2021 aarch64 GNU/Linux
. This shows that I am running the 64-bit kernel.
Installing JRE 11 with sudo apt install default-jre
seems to be installing the 32-bit version of Java 11.
I first thought that apt
was installing the 32-bit version and I had to change it to the ARM64 architecture so I followed this answer from another question. This only lead to more errors when I went to sudo apt update
and didn't install the 64-bit version.
So the next thing I tried was dowloaded an aarch64
version of OpenJDK11. I did the following (slightly modified from here):
cd /home/pi/
wget https://cdn.azul.com/zulu-embedded/bin/zulu11.35.36-ca-jdk11.0.5-linux_aarch64.tar.gz
tar -xvzf zulu*tar.gz
mv zulu11.35.36-ca-jdk11.0.5-linux_aarch64 java-11-zulu-aarch64
mv java-11-zulu-aarch64 /usr/lib/jvm/java-11-zulu-aarch64
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-11-zulu-aarch64/java 1091
After I had set update-alternatives
with the newly installed Java:
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-armhf/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-armhf/bin/java 1111 manual mode
* 2 /usr/lib/jvm/java-11-zulu-aarch64/bin/java 1091 manual mode
3 /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java 1081 manual mode
Running java -version
outputs this:
-bash: /usr/bin/java: No such file or directory
What am I doing wrong and how can I get an installation of ARM64 Java JDK on my Raspberry Pi Model 4?
Could it be a possibility that I needed to have flashed the 64-bit Raspbian Lite OS from here, rather than flashing the 32-bit then setting arm_64bit=1
?