JREs from different vendors on the same system

14,412

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

Share:
14,412
Alpi
Author by

Alpi

Updated on September 18, 2022

Comments

  • Alpi
    Alpi over 1 year

    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?

  • JAMSHAID
    JAMSHAID over 4 years
    it worked like a charm
  • Sarz
    Sarz over 2 years
    Bravo my friend, it works ;)