Javascript required
Skip to content Skip to sidebar Skip to footer

How to Install Java in Ubuntu Using Terminal

Hello, friends. We know that Java is one of the most popular programming languages and now it's version 16. So in this post, you'll learn how to install Oracle Java 16 on Ubuntu 20.04 / 18.04

Java is one of the preferred languages by many developers but it is also necessary to run other very important software. In this sense, Oracle from time to time releases a new version that includes good news.

So, if you are a developer and want to try Java 16 on Ubuntu, this post will help you with that.

Install Oracle Java 16 on Ubuntu

The easiest way to install Oracle Java on Ubuntu is by using the PPA of the Linuxuprising people.

In a very brief way, the package is an installer that takes care of downloading the Oracle binaries. Also, it extracts them and copies them in the appropriate directory and everything by us.

So, it opens a terminal or an SSH session.

Once the terminal is started, it updates the whole system:

sudo apt update
sudo apt upgrade

This way we will have the system ready with the security patches to start the installation.

Now, add the PPA repository:

sudo add-apt-repository ppa:linuxuprising/java Oracle Java 11 (LTS) and 16 installer for Ubuntu (21.04, 20.10, 20.04, 18.04, 16.04 and 14.04), Pop!_OS, Linux Mint and Debian.  Java binaries are not hosted in this PPA due to licensing. The packages in this PPA download and install Oracle Java, so a working Internet connection is required.  The packages in this PPA are based on the WebUpd8 Oracle Java PPA packages: https://launchpad.net/~webupd8team/+archive/ubuntu/java  Created for users of https://www.linuxuprising.com/  Installation instructions (with some tips), feedback, suggestions, bug reports etc.:  Oracle Java 11: https://www.linuxuprising.com/2019/06/new-oracle-java-11-installer-for-ubuntu.html  Oracle Java 16: https://www.linuxuprising.com/2021/03/how-to-install-oracle-java-16-on-debian.html  Important notice regarding Oracle Java 11 and newer: the Oracle JDK license has changed starting April 16, 2019. The new license permits certain uses, such as personal use and development use, at no cost -- but other uses authorized under prior Oracle JDK licenses may no longer be available. A FAQ is available here: https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html . After this change, new Oracle Java 11 releases (11.0.3 and newer) require signing in using an Oracle account to download the binaries. This PPA has a new installer that requires the user to download the Oracle JDK 11 .tar.gz and place it in a folder, and only then install the "oracle-java11-installer-local" package. Details here:  https://www.linuxuprising.com/2019/06/new-oracle-java-11-installer-for-ubuntu.html  About Oracle Java 10, 12, 13 and 14: These versions have reached the end of public updates, therefore they are longer available for download. The Oracle Java 10/12/13/14 packages in this PPA no longer worked due to this, so I have removed them. Switch to Oracle Java 11 or OpenJDK 11 instead, which is long term support, or the latest Java 16.   More info: https://launchpad.net/~linuxuprising/+archive/ubuntu/java  Press [ENTER] to continue or Ctrl-c to cancel adding it.
1.- Add the PPA to install Oracle Java 16
1.- Add the PPA to install Oracle Java 16

It then updates the repositories using APT:

sudo apt update

So, now you can start the installation of Oracle Java 16 on Ubuntu, to do this run:

sudo apt install oracle-java16-installer Reading package lists… Done  Building dependency tree         Reading state information… Done  The following additional packages will be installed:    binutils binutils-common binutils-x86-64-linux-gnu java-common libbinutils libctf-nobfd0 libctf0  Suggested packages:    binutils-doc binfmt-support visualvm ttf-baekmuk | ttf-unfonts | ttf-unfonts-core ttf-kochi-gothic | ttf-sazanami-gothic ttf-kochi-mincho | ttf-sazanami-mincho    ttf-arphic-uming firefox | firefox-2 | iceweasel | mozilla-firefox | iceape-browser | mozilla-browser | epiphany-gecko | epiphany-webkit | epiphany-browser | galeon    | midbrowser | moblin-web-browser | xulrunner | xulrunner-1.9 | konqueror | chromium-browser | midori | google-chrome  Recommended packages:    gsfonts-x11 oracle-java16-set-default  The following NEW packages will be installed:    binutils binutils-common binutils-x86-64-linux-gnu java-common libbinutils libctf-nobfd0 libctf0 oracle-java16-installer  0 upgraded, 8 newly installed, 0 to remove and 39 not upgraded.  Need to get 2,433 kB of archives.  After this operation, 13.9 MB of additional disk space will be used.  Do you want to continue? [Y/n]

During the installation, you will see a screen where you will have to accept the license terms. After accept them, the installation will continue.

2.- Accept the license terms
2.- Accept the license terms

To make Java 16 the default version, install this package:

sudo apt install oracle-java16-set-default

Then, verify the installation with the following command:

java --version java 16 2021-03-16  Java(TM) SE Runtime Environment (build 16+36-2231)  Java HotSpot(TM) 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)

So, Java 16 is installed and ready to use.

Conclusion

Java 16 has been released with many new features and this makes many want to leap an old version to this one. Therefore, in this post, you could learn how to install it in Ubuntu.

So, share this post with your friends and join our Telegram channel

How to Install Java in Ubuntu Using Terminal

Source: https://www.osradar.com/install-oracle-java-ubuntu/