How to change the default version of java by command line in Manjaro?
Asked Answered
B

1

21

I use Manjaro operating system I have installed OpenJDK version 11 and 18 (version 11 is installed first) and when I type java --version command in terminal it shows version 11.

java --version
openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+3)
OpenJDK 64-Bit Server VM (build 11.0.15+3, mixed mode)

How should I change the default Java version? Is it possible to install update-alternatives on Manjaro?

Bustard answered 19/8, 2022 at 9:19 Comment(0)
B
41

in archlinux based distros you could use archlinux-java instead of update-alternatives.

use archlinux-java status to view the list of installed java versions and default one; then use archlinux-java set <JAVA_ENV>.

Basion answered 18/9, 2022 at 9:18 Comment(1)
There is also archlinux-java fix that fixes default Java environment configuration. Should be run with sudo though.Satiable

© 2022 - 2024 — McMap. All rights reserved.