aAlalirezaSouri
aAlalirezaSouri

Reputation: 241

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

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?

Upvotes: 24

Views: 20643

Answers (1)

raven
raven

Reputation: 1154

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>.

Upvotes: 49

Related Questions