How to install Graalvm Java JDK on a Raspberry Pi

  Uncategorized
# uninstall other JDKs, ex:
sudo apt purge openjdk-17-jre-headless
sudo apt autoremove

# graalvm setup on a raspberry pi
cd ~
mkdir ~/tmp
cd ~/tmp
wget https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-aarch64_bin.tar.gz
tar xvf graalvm-jdk-21_linux-aarch64_bin.tar.gz

# move it in /opt and link to current
sudo mkdir /opt/graalvm
sudo mv ~/tmp/graalvm-jdk-21.0.2+13.1 /opt/graalvm/
sudo ln -s /opt/graalvm/graalvm-jdk-21.0.2+13.1 /opt/graalvm/current
ls -la /opt/graalvm

# add the java home
nano ~/.bashrc

# at the bottom, add:
export JAVA_HOME=/opt/graalvm/current
export PATH=$PATH:$JAVA_HOME/bin
source ~/.bashrc

# test it

pi@devpi:~ $ java -version
java version "21.0.2" 2024-01-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.2+13.1 (build 21.0.2+13-LTS-jvmci-23.1-b30)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.2+13.1 (build 21.0.2+13-LTS-jvmci-23.1-b30, mixed mode, sharing)

pi@devpi:~ $ javac -version
javac 21.0.2