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?

Alpi
  • 61
  • 1
  • 1
  • 3

1 Answers1

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

Deepen
  • 4,049
  • 4
  • 22
  • 32