Installing the latest version of Java is always a bit messy and wanted to see if I'm doing everything right.
I currently have Java 16 in this path /usr/lib/jvm/adoptopenjdk-16-hotspot-armhf
I followed the following tutorial 2) Install OpenJDK 17 on Debian 10/9 and everything went OK.
My JAVA_HOME is correct and set to /opt/jdk17, but my java --version is still using Java 16.
java --version
openjdk 16.0.1 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9)
OpenJDK Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode)
Other useful information
pi@raspberrypi:~ $ which java
/usr/bin/java
pi@raspberrypi:~ $ echo $PATH
/home/pi/.local/bin:/bin:/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
My PATH variable doesn't seem to contain /opt/jdk-17 but even after running source /etc/profile.d/jdk.sh and /opt/jdk-17 present, java --version is still using Java 16.