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:

Copy... $  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.

Answer from TacticalCoder on Stack Overflow
🌐
Brainly
brainly.com › computers and technology › high school › how do you downgrade the java version in rhel 7?
[FREE] How do you downgrade the Java version in RHEL 7? - brainly.com
September 30, 2023 - To downgrade Java on RHEL 7, first remove the current Java version with 'yum remove', then install the desired version with 'yum install', and finally verify with 'java -version'. Root or superuser access is required.
🌐
Red Hat
access.redhat.com › solutions › 7068103
How can downgrade the JAVA version from 1.8.0_401 to 1.8.0_351 ? - Red Hat Customer Portal
Customer is not being able to see the jdk 1.8_351 version, They're looking for a guidance on where they can download it. They are going to do the RPM Install.
Discussions

ubuntu - downgrade java version - Stack Overflow
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? More on stackoverflow.com
🌐 stackoverflow.com
How to Downgrade java version in centos? - Stack Overflow
I have installed java in Centos 6.7 with version: java -version java version "1.6.0_38" OpenJDK Runtime Environment (IcedTea6 1.13.10) (rhel-1.13.10.0.el6_7-x86_64) OpenJDK 64-Bit Server VM (build... More on stackoverflow.com
🌐 stackoverflow.com
centos - How to yum downgrade to a specific version of packet like jdk? - Unix & Linux Stack Exchange
I know it's sudo yum downgrade - but always can't find the packet. for example sudo yum --showduplicates list java-1.7.0-openjdk Installed Packages java-1.7.0- More on unix.stackexchange.com
🌐 unix.stackexchange.com
How to downgrade from java11 to java8?
Try running these commands: wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ apt-get update -y && apt-get install -y adoptopenjdk-8-hotspot More on reddit.com
🌐 r/Crostini
10
6
October 24, 2020
🌐
Red Hat
access.redhat.com › solutions › 29617
How to use yum/dnf to downgrade or rollback some package updates? - Red Hat Customer Portal
May 1, 2025 - ... [root@host ~]# yum downgrade httpd-2.2.3-22.el5 [snip] Dependencies Resolved ======================================================================================================================== Package Arch Version Repository Size ...
Top answer
1 of 6
15

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:

Copy... $  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.

2 of 6
13

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

Copysudo update-alternatives --config java

And select the desired version.

If you wish, run it for javac and javaws:

Copysudo 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

🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-newbie-8 › downgrading-java-1-6-to-java-1-4-a-880296
[SOLVED] Downgrading Java 1.6 to Java 1.4
Hi all I need to downgrade my java version from 1.6 to 1.4 for some reasons (trust me , it's necessary) so , can someone provide me some info how i
Find elsewhere
🌐
The Geek Diary
thegeekdiary.com › how-to-switch-back-to-previous-version-of-openjdk-in-centos-rhel
How to Switch Back To Previous Version of openjdk in ...
GitLab CI/CD is a tool used for automating the process of testing, building, and deploying code. It helps developers integrate and deliver software quickly and reliably. Here’s a breakdown of the p · © 2025 Sandeep. Some rights reserved
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › software & applications
[SOLVED] How to downgrade Java version - Linux Mint Forums
April 24, 2019 - Hello: I recently upgrade myself to the latest Linux Mint. This comes with Java 10 as standard. Unfortunately one of the main programs I use is Ancetris, a family tree maker. Their current build needs Java 8 to work. I followed various instructions online as to how to do this but none of them work: http://tipsonubuntu.com/2016/07/31/inst ... x-mint-18/ Is there not a simple way using the Package Manager to downgrade ...
🌐
MTU Service Desk
servicedesk.mtu.edu › TDClient › KB › ArticleDet
Changing Java versions (Linux) - Service Desk
All on-domain Red Hat Enterprise Linux (RHEL) systems are running OpenJDK Java as the system default. However, OracleJDK is also available. This article demonstrates how users can change their Java version to meet their use case · Currently, the Linux Lab image contains 8 versions of Java:
🌐
Reddit
reddit.com › r/crostini › how to downgrade from java11 to java8?
r/Crostini on Reddit: How to downgrade from java11 to java8?
October 24, 2020 -

I have spent around 2 weeks now scouring all over the web trying to find out how to install it without it giving some stupid error like "E: Unable to locate package openjdk-8-jdk" and it not getting detected by the system. I have manged to install open-java8 on sdk, but the system does not detect it. I need java8 for minecraft as older modded versions of the game are really buggy in java11 and crash at start. How can I install and downgrade to java8, and for an linux application for minecraft, be able to see it?

🌐
Baeldung
baeldung.com › home › installation › removing old versions of java and installing new versions on linux
Removing Old Versions of Java and Installing New Versions on Linux | Baeldung on Linux
January 14, 2025 - $ tar -xvf jdk-21_linux-x64_bin.tar.gz $ sudo mv jdk-21* /opt/ Next, let’s configure the system to recognize this new Java installation:
Top answer
1 of 1
8

Download

Go to official java download page, scroll down to the bottom of the page until you see Previous Releases. Click Download

Choose Java SE 7 on the next page and you will see web-page where you can choose specific Java version. If you unsure what to choose, choose Development Kit - it will cover all your needs

Now you will get this page. And you see something like screenshot below. Choose tar.gz depending on your architecture, I highlighted two of them that fits Ubuntu:

Oracle may ask you to sign up before download


Installation

Now you have file jdk*.tar.gz. Here is great manual about installing java. I took out the instruction and changed it a little bit.

  • Uncompress .tar.gz

    tar -xvf jdk*

The JDK package is extracted into jdk.xxx directory. Check carefully this folder name, because we will use it the next step. I'm assuming that path to this new extracted folder is path_to_jdk_folder and folder name is folder_name, you should manually change it before executing commands below.

Usually it is:

path_to_jdk_folder - /home/c0rp/Downloads/jdk1.7.0

folder_name - jdk1.7.0

  • Installing

Run sudo update-alternatives --list java to check if you have configured java already.

$ sudo update-alternatives --list java
/usr/lib/jvm/jdk1.6.0_45_x586/bin/java
/usr/lib/jvm/jdk1.7.0_21/bin/java
/usr/lib/jvm/jdk1.8.0/bin/java

If it is saying update-alternatives: error: no alternatives for java run this set of commands. Don't forget replace path_to_jdk_folder and folder_name:

sudo mkdir /usr/lib/jvm
sudo mv path_to_jdk_folder /usr/lib/jvm/folder_name
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/folder_name/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/folder_name/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/folder_name/bin/javaws" 1
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws

If there is no errors and your java list is not empty, run this set of commands. Don't forget replace path_to_jdk_folder and folder_name:

LNUM=$[$(update-alternatives --list java | wc -l) + 1]
sudo mv path_to_jdk_folder /usr/lib/jvm/folder_name
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/folder_name/bin/java" "$LNUM"
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/folder_name/bin/javac" "$LNUM"
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/folder_name/bin/javaws" "$LNUM"
  • Run

    sudo update-alternatives --config java
    

You will see output similar to the one below - choose the number of new jdk1.7.0 (folder_name) - for example 2 in this list (unless you have have never installed Java in your computer in which case a sentence saying There is nothing to configure will appear):

    $ sudo update-alternatives --config java
    There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      auto mode
  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode
  2            /usr/lib/jvm/jdk1.7.0/bin/java                   1         manual mode
* 3            /usr/lib/jvm/jdk1.8.0/bin/java                   1         manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/jdk1.8.0/bin/java to provide /usr/bin/java (java) in manual mode

Repeat the above for:

sudo update-alternatives --config javac
sudo update-alternatives --config javaws

Check installation

java -version
🌐
Red Hat
access.redhat.com › solutions › 7134119
How To Install A Specific Kernel Version Or Downgrade The Kernel - Red Hat Customer Portal
To help identify the specific name of a kernel package to downgrade to, DNF can list all the versiosn of a packages, both installed and available for installation; ... Updating Subscription Management repositories. ======================== Name & Summary Matched: kernel ======================== kernel-4.18.0-553.72.1.el8_10.x86_64 : The Linux kernel, based on version 4.18.0, heavily modified with backports kernel-4.18.0-553.77.1.el8_10.x86_64 : The Linux kernel, based on version 4.18.0, heavily modified with backports kernel-4.18.0-553.80.1.el8_10.x86_64 : The Linux kernel, based on version 4.18.0, heavily modified with backports kernel-4.18.0-80.el8.x86_64 : The Linux kernel kernel-4.18.0-80.1.2.el8_0.x86_64 : The Linux kernel ...
🌐
nixCraft
cyberciti.biz › nixcraft › howto › centos › centos/rhel use yum command to downgrade or rollback updates
CentOS/RHEL Use yum Command To Downgrade or Rollback Updates - nixCraft
August 19, 2023 - Explains how to downgrade or rollback updates using YUM on a CentOS, Red Hat (RHEL), Rocky, Alma and Fedora Linux.
🌐
MTU Service Desk
servicedesk.mtu.edu › TDClient › 1801 › Portal › KB › ArticleDet
Article - Changing Java versions (Linux)
All on-domain Red Hat Enterprise Linux (RHEL) systems are running OpenJDK Java as the system default. However, OracleJDK is also available. This article demonstrates how users can change their Java version to meet their use case · Currently, the Linux Lab image contains 8 versions of Java:
🌐
Oracle
support.oracle.com › knowledge › Oracle Linux and Virtualization › 2056238_1.html
Oracle
We've detected that JavaScript is disabled in your browser. Visual Builder applications cannot run without JavaScript. Please enable JavaScript in your browser