Open an ssh session as root to the DietPI machine.
Type the following commands:
cd /tmpwget https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_linux-x64_bin.tar.gztar -xvf openjdk-21.0.2_linux-x64_bin.tar.gzmv jdk-21.0.2/ /opt/jdk-21echo 'export JAVA_HOME=/opt/jdk-21' >> /etc/bash.bashrc
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> etc/bash.bashrcexit
open the ssh session again and check if java is available:java --version
This should output something like
openjdk 21.0.2 2024-01-16
OpenJDK Runtime Environment (build 21.0.2+13-58)
OpenJDK 64-Bit Server VM (build 21.0.2+13-58, mixed mode, sharing)
Above instructions are for the current jdk version (21.0.2) on an x64 machine (Microsoft Hyper-V VM). Change the url and filename at items 2 and 3 for other versions. (See https://jdk.java.net/ )