47

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.

0

1 Answer 1

100
  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. Add JAVA_HOME variable:

     export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
    
  4. 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.

2
  • 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, 2019 at 18:33
  • When I try sudo apt-get install openjdk-8-jre I get this error: Errors were encountered while processing: oracle-java11-installer-local. E: Sub-process /usr/bin/dpkg returned an error code (1).How to remove oracle-java11-installer-local. Jun 1, 2020 at 3:11

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