简体   繁体   中英

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?

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 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

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

您可以从Java SE 6存档部分下载它。

I find Jenv to be the easiest way to switch between Java versions. You can set a Java version globally, or you can set it so that certain directories will use a specified version of Java. See their website

once installed with Homebrew or cloned from github its as easy as:

jenv add /path/to/java1.6.20/home

jenv global 1.6.20

$sudo apt-get install openjdk-8-jre (replace with the version you want to install)

$sudo update-alternatives --config java {will get the option to choose the alternative java on your machine}

select the one you want to use as default

$java -version Check the java version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM