A short note about HowTo install and set a specific Java version when you have various versions installed.
Will use the archlinux-java
script, see the Switching between JVM.
Install a package itself, here it will be Oracle Java 14:
[simterm]
$ yay -S jdk :: Checking for conflicts... :: Checking for inner conflicts... [Aur: 2] jre-14.0.1-1 jdk-14.0.1-1 ...
[/simterm]
Check currently used – in this case, it’s old OpenJDK 11:
[simterm]
$ java --version openjdk 11.0.6 2020-01-14 OpenJDK Runtime Environment (build 11.0.6+10) OpenJDK 64-Bit Server VM (build 11.0.6+10, mixed mode)
[/simterm]
List all installed versions:
[simterm]
$ archlinux-java status Available Java environments: java-11-openjdk (default) java-14-jdk java-8-jdk
[/simterm]
Set the Oracle Java 14 as the active version to be used by default now:
[simterm]
$ sudo archlinux-java set java-14-jdk
[/simterm]
Check again:
[simterm]
$ java --version java 14.0.1 2020-04-14 Java(TM) SE Runtime Environment (build 14.0.1+7) Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
[/simterm]
Done.