24

How can i downgrade the java version 11 to java 8. As i need jenkins, current jenkins versoin doesn't support java 11. I need to downgrade.

43
  1. You have to install the openjdk-8-jre:

    sudo apt-get install openjdk-8-jre
    
  2. Next switch to the jre-8 version:

    $ 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-9-openjdk-amd64/bin/java       1500      auto mode
      1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1500      manual mode
      2            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1500      manual mode
    
  3. check java version:

    $ java -version
    openjdk version "1.8.0_151"
    OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
    OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
    

Same procedure for Oracle java.

| improve this answer | |
  • What is update-alternatives? I get sudo: update-alternatives: command not found when I try to run it. I don't have apt installed. Is it part of that? – Mike S. Oct 3 '19 at 18:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.