Assalamu Alaikum.
Welcome to Uddoyon, in this article we try to know How to Install Java 8, 11 and 17 on Ubuntu System so keep reading…
Java is a versatile and widely-used programming language, and having multiple versions installed on your Ubuntu system can be essential for various software development tasks. In this guide, we’ll walk you through the steps to install Java 8, 11 and 17 on your Ubuntu system.
Prerequisites
Before we begin, ensure you have the following:
- An Ubuntu system with administrative privileges (you can use the
sudo
command). - A terminal or command-line interface.
Installing Java 8 Ubuntu
Java 8 is still commonly used, especially in legacy projects. To install it on your Ubuntu system, follow these steps:
- Open your terminal.
- Update the package list to ensure you have the latest information about available packages:
sudo apt update
- Install OpenJDK 8:
sudo apt install openjdk-8-jdk -y
- Verify the installation by checking the Java version:
java -version
Installing Java 11 Ubuntu
Java 11 is a Long-Term Support (LTS) release, known for its stability and long-term support. To install it:
- Open your terminal.
- Update the package list:
sudo apt update
- Install OpenJDK 11:
sudo apt install openjdk-11-jdk -y
- Verify the installation:
java -version
Installing Java 17 Ubuntu
Java 17 is another LTS version, offering stability and long-term support. To install it:
- Open your terminal.
- Update the package list:
sudo apt update
- Install OpenJDK 17:
sudo apt install openjdk-17-jdk -y
- Verify the installation:
java -version
Setting Default Java Version
You can set the default Java version on your Ubuntu system using the update-alternatives
command:
sudo update-alternatives --config java
This command will display a list of installed Java versions. Choose the desired version by entering its corresponding number.
Conclusion
Congratulations! You have successfully installed Java 8, 11 and 17 on your Ubuntu system. Having these different Java versions available allows you to work on a wide range of projects with varying compatibility requirements. Make sure to select the appropriate Java version based on your specific development needs, taking into account factors like stability, support, and feature requirements.