6

In various tutorials, it is said, that you should remove existing JRE/JDK before installing new one (e.g. remove OpenJDK before installing the one from Oracle). Is it really necessary? I remember having 2 JREs at one point, being able to choose in my IDE which to run program on.

Don't remember to have any conflicts, what's the chance of having any?

1 Answer 1

11

You can install multiple JRE/JDK at a time. You just need to configure which one to use by using update-alternatives

sudo update-alternatives --config java

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status


0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode

1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode

* 2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode

Press enter to keep the current choice[*], or type selection number: 1

Similarly, you can configure your JDK with

sudo update-alternatives --config javac

2
  • it worked like a charm
    – JAMSHAID
    Commented Nov 17, 2019 at 16:27
  • Bravo my friend, it works ;)
    – Sarz
    Commented Aug 21, 2021 at 8:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .