Last Updated on June 2, 2022 by admin
This tutorial post will help you to install Java on your Ubuntu 22.04 LTS. Java is the most popular object-oriented programming language. There are multiple applications required for your system that required Java on your system. Here we will install Java (OpenJDK 11 and OpenJDK 8) or Oracle Java 14.
Install Java on Ubuntu 22.04 LTS
Java 11 is the latest LTS version that is available for installation. At first, we need to install JRE or Java runtime environment. The default Ubuntu packages repositories contain the packages for the OpenJDK 11. The default repository also contains OpenJDK 8 previous stable release packages.
The JDK packages provide the full Java development libraries, helpful for the development systems. To run any Java application, you just needed a Java runtime environment (JRE).
1. Install Java 11 on Ubuntu 22.04 LTS
Run the following commands to install OpenJDK 11 package on Ubuntu 22.04 LTS.
sudo apt update sudo apt install openjdk-11-jdk
Once the installation is complete, you can verify it by checking the Java version:
java -version openjdk version "11.0.7" 2020-04-14 OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1) OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)
OpenJDK 11 has been installed.
Now run the following command to install OpenJDK 8 Ubuntu 22.04 LTS.
2. Install Java 8 on Ubuntu On Ubuntu 22.04 LTS.
Run the below command to install OpenJDK 8 package on Ubuntu 22.04 LTS.
sudo apt update sudo apt install openjdk-8-jdk
3. Install Oracle Java 14 On Ubuntu 22.04 LTS.
Run the following command to download the Debian file using the command line.
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn-pub/java/jdk/14.0.1+7/664493ef4a6946b186ff29eb326336a2/jdk-14.0.1_linux-x64_bin.deb"
Or download the .deb package from the official download page. Once you download the Debian file, install it on your system using the command below:
sudo dpkg -i jdk-14.0.1_linux-x64_bin.deb
This post is specially designed for the beginner level of Linux users or the people who are installing java for the first time on Ubuntu. In this tutorial, you have learned about the installation of Java on the Ubuntu Ubuntu 22.04 LTS. Please let us know if there is any broken link or error on this page.