How to Install Java-6 & Java-7 in Ubuntu?
Last Updated :
27 Sep, 2024
Several applications use Java as they require older versions like Java 6 and Java 7, whereas their newer versions might not be preferred. Having these versions available on Ubuntu allows you to run legacy applications while flexibly shifting between different Java environments.
How to install Java-6 & Java-7 in Ubuntu?
To Install Both of these Java-6 & 7 in Ubuntu follow the given below steps.
1. Installing Java 6
Step 1: Go to this link.
https://www.oracle.com/in/java/technologies/javase-java-archive-javase6-downloads.html
jdk-6u45-linux-x64.bin.
download this fileAfter that You will download the file.
- Open the Terminal and type this command.
cd Downloads
TerminalNow you are in file Directory.
Step 2: To make the downloaded bin file executable use the following command.
chmod +x jdk-6u45-linux-x64.bin
Step 3: To extract the bin file use the following command.
./jdk-6u45-linux-x64.bin
Step 4: Using the following command create a folder called "jvm" inside /usr/lib if it is not already existing.
sudo mkdir /usr/lib/jvm
Step 5: Move the extracted folder into the newly created jvm folder.
sudo mv jdk1.6.0_32 /usr/lib/jvm/
Step 6: To install the Java source use following commands.
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_32/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_32/bin/java 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_32/bin/javaws 1
Step 7: To make this default java.
sudo update-alternatives --config java

Step 8: To verify Java has installed correctly use this command.
java -version
Version 6 JavaInstalling Java 7
Step 1:
Go to https://www.oracle.com/in/java/technologies/javase/javase7-archive-downloads.html.
- Select jdk-7u80-linux-i586.tar.gz
After that You will download the file.
- Open the Terminal and type this command.
cd Downloads

Step 2: To make the downloaded bin file executable use the following command.
chmod +x jdk-7u80-linux-i586.tar.gz
Step 3: To extract the bin file use the following command.
./jdk-7u80-linux-x64.bin
Step 4: Using the following command create a folder called "jvm" inside /usr/lib if it is not already existing.
sudo mkdir /usr/lib/jvm
Step 5: Move the extracted folder into the newly created jvm folder.
sudo mv jdk1.7.0_80/usr/lib/jvm/
Step 6: To install the Java source use following command.
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_32/bin/java 1
Step 7: To make this default java.
sudo update-alternatives --config java
Step 8: To make symlinks point to the new Java location use the following command.
ls -la /etc/alternatives/java*
Step 9: To verify Java has installed correctly use this command
Conclusion
You can install Java 6 and Java 7 in Ubuntu, which means all your older applications will keep running. This allows the flexibility for you to run legacy as well as modern Java-based programs since you can administer versions.
Similar Reads
How to Install Java in Ubuntu? (2 Easy Methods)
Java Virtual Machine (JVM) is the essential component that allows any Java program to be executed. To operate it smoothly, you will need at least one Command Line Tool. However, if you are on the Ubuntu Operating System, your job has already been simplified significantly. If you are looking to compl
4 min read
How to install JUnit 5 on Ubuntu?
JUnit 5 is a powerful and widely used testing framework for Java applications. Installing JUnit 5 on Ubuntu involves configuring a Java project with the necessary dependencies. Begin by setting up a Java project using a build tool such as Maven or Gradle, and then include JUnit 5 as a dependency. Th
4 min read
How to install PhpStorm in Ubuntu?
Installing PhpStorm on Ubuntu can significantly enhance your web development experience by providing a powerful IDE tailored for PHP development. This guide will walk you through the simple steps to install PhpStorm on your Ubuntu system, ensuring you have all the tools you need to code efficiently
3 min read
How to install John the Ripper in Ubuntu
John the Ripper is one of the most popular and effective password-cracking tools available today. Originally developed for the Unix operating system, John the Ripper is now compatible with over fifteen different platforms, including various versions of Unix, Windows (Win32), DOS, BeOS, and OpenVMS.
4 min read
How to install Rider on Ubuntu?
Are you looking to install Rider on your Ubuntu system? Rider, the powerful IDE from JetBrains, is a popular choice for .NET developers seeking a robust development environment on Linux. In this guide, we will provide you with a step-by-step tutorial on how to install Rider on Ubuntu. Whether you ar
3 min read
How to install php70-gd on Ubuntu ?
Graphics Draw or GD library is an open-source library for dynamic creation of images. It is used to create and manipulate image files in a variety of different image formats, including GIF, PNG, JPEG, WBMP, and XPM. This package for PHP 7 can be installed via the PPA by Ondrej Surý. To install php7.
2 min read
How to Install Java on macOS?
The Java Development Kit (JDK) is an essential tool for developers working with Java. It provides the necessary tools and libraries to build, compile, and run Java applications, making it a cornerstone for efficient and effective Java development. Without the JDK, writing and testing Java programs w
7 min read
How to Install OpenJDK (Free Java) in Windows
We all know that Java is one of the most popular programming languages and comes under the top 10 most used programming languages. Now, if you are starting your Java learning, then you need to install the Java Development Kit (JDK) on your machine. OpenJDK is a free and open-source version of the Ja
5 min read
Installing Java 14 in Ubuntu and Linux Mint
The JDK is a development environment for building applications using the Java programming language. The JDK includes tools useful for developing and testing programs. Here we will install the Java14 in Linux. Installing in Ubuntu: Here we are going to PPA repositories to install javajdk-14 on ubuntu
2 min read
How to Install Deb Files (Packages) on Ubuntu
Installing the application on Windows is an easy task, as we just need to download the .exe file of the application and complete the installation in simple clicks, but the installation of the application on Linux or Ubuntu is quite different from Windows. We need to execute the commands and perform
7 min read