GitopsCentral

How to downgrade java on ubuntu/kali linux

Filed under: linux — Tags: , , , — shaik zillani @ 10:17 am
java-linuxx

In this blog post I am going to show you how to downgrade java and javac on ubuntu/kali linux. Some applications will require older version of java; For instance, I had to downgrade from openjdk 10 to openjdk 8 because Jenkins doesn’t support openjdk 10.

jdk10

The availability of java versions depends on your repository source list (/etc/apt/source.list). Use the command below to search for available jdks and then select one from them,

sudo apt-cache search jdk

In my case I will choose jdk8, so let me install jdk8 using the commands below.

sudo apt-get update 
sudo apt-get install openjdk-8-jdk

This will install java jdk8, but we need to make a selection for default version of java among the existing versions i.e; between jdk10 & jdk8. To change this preference use the command below and make a selection.

sudo update-alternatives --config javac
update alternatives java

This will update for javac, the java compiler. Now, let’s do the same for java

sudo update-alternatives --config java
update alternatives for java

Now, let’s check the java & javac versions.

java & javac version

Please make sure to checkout other blog posts on goacademy

© 2016–2025 GitOpsCentral | All Rights Reserved.