Arun
Arun

Reputation: 2478

Editing PATH for Java

I am using Manjaro GNU/Linux 5.7.0-3 x86_64 and had installed older Java Oracle jdk1.8 previously but now I want to install Oracle jdk14.0.1 which I have unpacked to /opt.

In order to reflect the changes, I edited ~/.bashrc file by adding this line:

export PATH="/home/arjun/anaconda3/condabin:/home/arjun/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/jdk-14.0.1/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl"

Then executed these to reload the terminal:

source ~/.bashrc
bash;

And I even restarted the computer but still, Java is using the older version:

$ javac -version
javac 1.8.0_252

What's going wrong?

Thanks!

Upvotes: 1

Views: 743

Answers (2)

roozbeh sharifnasab
roozbeh sharifnasab

Reputation: 303

In ArchLinux and manjaro you can use pre-installed archlinux-java utility.

for getting information about all installed java's and current choice, you need status and for change it you can use set

sudo archlinux-java status
sudo archlinux-java set java-14-jdk # or something similar related to java14

read more about it in the wiki

Upvotes: 1

Mehmet Bektaş
Mehmet Bektaş

Reputation: 181

Because of different versions of java are installed, you can change default option with this command.

sudo update-alternatives --config java

With this command, you can select java version as default option.

Upvotes: 0

Related Questions