How to install java and remove all old java packages?

I tried to install java from AUR and when i checked java -version its still the old one. Thanks for your help in advance.

Which package did you install? Manjaro normally comes with jre-openjdk already installed by default.

I installed it from here https://aur.archlinux.org/jdk.git and i did find out that i have to set it to the newest version with sudo archlinux-java set java-20-openjdk

how can i check?

So you installed a .git version of jdk. Why not use jdk-openjdk from the repo — which, again, should have been installed by default already?

I would, how can i? I think there was an older version installed and the only guide i found installed a .git version. I also don’t know which i set now. Isn’t it the jdk-openjdk?

java -version                                                                                  ✔ 
openjdk version "20.0.2" 2023-07-18
OpenJDK Runtime Environment (build 20.0.2+9)
OpenJDK 64-Bit Server VM (build 20.0.2+9, mixed mode, sharing)

Don’t just follow any guides you find on the internet, and especially not when it pertains to other distributions than Manjaro. It’s a bad strategy and it’s bound to get you into trouble.

The jre-openjdk and jdk-openjdk packages from the Manjaro repo are fully up to date, and their version is the same as that of the git version you got off the AUR.

You are better off removing the AUR package and sticking with the openjdk versions.

Note: Just because something has a higher version number doesn’t mean that it’s better. That’s Windows-think.

1 Like

It was for Manjaro.

hwo

How do you know?

Because I’ve just checked.

1 Like

Oh, i see so should i stick with the 11. version?

sudo pacman -Rsn <pkgname>?

You should have both version 11 and version 20 installed. 11 is only there as a dependency for another package. 20 is the one that will normally be used for everything else.

Ok so i probably have the right one set

Yes.


Yes. :wink:

Where can i find the package name? I dont remember it.

It will probably just be called jdk — the short name. Either way, you can look it up in octopi or the pamac GUI. They can show you what you have installed and where from.

If it has an :alien: icon next to it, then it’s from the AUR or elsewhere, but not from the repositories. :wink:

1 Like

Thank you for your help…again. Youre keeping me alive.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.