Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 891
aAlalirezaSouri Avatar asked Sep 07 '25 01:09

aAlalirezaSouri


1 Answers

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

like image 157
raven Avatar answered Sep 09 '25 23:09

raven