I want to switch my java version with the command update-alternatives --config java, but I don't see any changes after that. I'm using that command and have this output:
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number: 1
Before it I have used Java 8 and selection was set on /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java. Then I switched, run java -version and have the same version as it was - Java 8:
$ java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment Corretto-8.212.04.1 (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM Corretto-8.212.04.1 (build 25.212-b04, mixed mode)
I changed JAVA_HOME and PATH to use Java 11, but it still changed nothing:
$ echo $PATH
/home/user9679/.sdkman/candidates/java/current/bin:/home/user9679/.sdkman/candidates/gradle
/current/bin:/home/user9679/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/
bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-1.11.0-openjdk-amd64/
$ echo $JAVA_HOME
/usr/lib/jvm/java-1.11.0-openjdk-amd64/