- Update the list of
aptpackages to the latest versions by executing the following command:sudo apt update - Install the latest version of Debian OpenJDK 17 by executing the following command:
sudo apt install openjdk-17-jdk - When prompted, click Yes to continue.
- Execute the following command to verify the Java version:
java --version - If the expected latest version of OpenJDK 17.x.x is not returned, change the selected Java version by executing the following command:
update-alternatives --config java - Set the Java path by executing the following commands:
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 export PATH=$PATH:$JAVA_HOME/bin