Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

downgrade java version

I tried to downgrade java version.

If I use apt-get install sun-java6-jdk on Ubuntu, it will install java version 1.6.26 .

What I want is java 1.6.20. How can I downgrade java?

like image 346
chnet Avatar asked Feb 09 '12 21:02

chnet


3 Answers

Java on Linux doesn't need to be installed as root. You can install as many different Java versions you want on Linux, either in separate user accounts or in a single account.

I do it all the time (switching from one Java version to another) to test on various versions of the JVM.

Changing your Java version can be as simple as this:

... $  which  java
/home/b/jdk1.5.0_22/bin/java

... $  export  PATH=/home/b/jdk1.6.0_25/bin:$PATH

... $  which  java
/home/b/jdk1.6.0_25/bin/java

To fetch an old version, go to the "Oracle Java Archive" page (Google if link becomes broken):

http://www.oracle.com/technetwork/java/archive-139210.html

Then pick your poison. I download the .bin, chmod +x it and then I extract the Java version I want from the .tgz.

Then I simply set the PATH and I'm usually good to go.

I run my IDE (IntelliJ IDEA) using one Java version, I typically compile using another JDK and I test on several JVMs.

All this from the same user account.

So it's not as if you had to install "one" Java version on a Linux system...

Now, concretely, if I were you, I'd simply remove all traces from Java while being root, and then I'd download the old version I need from the Oracle Java Archive.

like image 94
TacticalCoder Avatar answered Sep 21 '22 18:09

TacticalCoder


like tactical coder said, you can install as many versions as you want, to switch the current version just run:

sudo update-alternatives --config java

And select the desired version.

If you wish, run it for javac and javaws:

sudo update-alternatives --config javac

sudo update-alternatives --config javaws

Source: https://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre

like image 30
Alejandro Zurcher Avatar answered Sep 20 '22 18:09

Alejandro Zurcher


Follow these steps to downgrade JAVA here[JAVA14 to JAVA8]:

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

sudo update-alternatives --config javac

Now Select the version of JDK

sudo update-alternatives --config java

Now Select the version of JRE
DONE
Check if it is downgraded by

java -version
like image 44
Harshit Chaurasia Avatar answered Sep 21 '22 18:09

Harshit Chaurasia