Java application development on linux

This topic describes the installation procedures of the JDK on the Linux platform, along with the system requirements.

General Notes About Installing the JDK on Linux Platforms from Archive Files

This topic describes general information about installing JDK 11 on Linux platforms.

Installing the JDK automatically creates a directory called jdk–feature.interim.update.patch where feature ( 11 ),interim, update, and patch represent corresponding values of version information.

If you install JDK in a specific location such as /opt , you must log in with root credentials to gain the necessary permissions. If you do not have the root access, either install the JDK in your home directory or a sub directory for which you have the write permissions.

If you install the software in a directory that contains a sub directory named jdk– 11 .interim.update.patch , the new software overwrites files of the same name in that directory. Ensure that you rename the old directory if it contains files that you would like to keep.

Installing the JDK from archive files doesn't configure the backing store for the system node of Java Preferences API ( java.util.prefs Java package). If this functionality of the JDK is required, you need to manually configure it by making sure either /etc/.java/.systemPrefs or jdk– 11 .interim.update.patch/.systemPrefs directory exists.

General Notes About Installing the JDK on Linux Platforms from RPM packages

This topic describes general information about installing JDK 11 from RPM packages on Linux platforms.

You can install only one version of JDK of the same feature release. If you try to install the newer version of the same feature release while the older version exists, the installer uninstalls the older version and installs the new version. For example, you can't install jdk- 11 and jdk- 11 .0.1 simultaneously. If you attempt to install jdk- 11 .0.1 after jdk- 11 is installed, the installer uninstalls jdk- 11 and installs jdk- 11 .0.1 .

All versions of JDK of the same feature release are installed in /usr/lib/jvm/jdk- 11 -oracle- directory, where equals x64 or aarch64 . Additionally /usr/java/jdk- 11 symbolic link pointing to the installation directory is created for backward compatibility.

If you install an older version of a JDK when the newer version of the same feature family already exists, an error is displayed, prompting you to uninstall a newer JDK version if an older version has to be installed.

You must log in with root credentials to install or update JDK.

By default, the installation script configures the system such that the backing store for the system node of Java Preferences API (java.util.prefs Java package) is configured in /etc/.java/.systemPrefs directory.

The JDK installation is integrated with the alternatives framework. After installation, the alternatives framework is updated to reflect the binaries from the recently installed JDK. Java commands such as java , javac , javadoc , and javap can be called from the command line.

Using the java -version command, you can confirm the default (recently installed) JDK version.

In addition, you can check which specific RPM package provides the java files:
$ rpm -q --whatprovides java

System Requirements for Installing JDK on Linux Platforms

See Oracle JDK Certified Systems Configurations for information about supported platforms, operating systems, and browsers.

Installing the JDK on Linux from Archive Files, Debian Packages, RPM Packages, and Oracle Linux Repositories

You can install the JDK on a Linux platform from archive files, debian packages, downloadable Red Hat Package Manager (RPM) packages files, or RPM packages from Oracle Linux (OL) repositories.

Installation can be performed by using one of the following processes:

JDK RPM packages for Generic Linux platforms and Oracle Linux platforms differ. The following table lists the differences:

Table 4-1 Difference between Generic Linux and OL platforms

JDK image is split into two packages: jdk- 11 -headless and jdk- 11 -headful .

jdk- 11 -headful package requires jdk- 11 -headless package. When these packages are installed together, they provide the same functionality as the jdk- 11 package for Generic Linux Platforms.

jdk- 11 -headless package registers java group with the alternatives framework.

jdk- 11 -headful package registers javac group with the alternatives framework.

Downloading the JDK Installer

Access Java SE Downloads page and click Accept License Agreement . Under the Download menu, click the Download link corresponding your requirement.

The following table lists the options and instructions for downloading and installing the JDK 11 release on a Linux platform:

Download File Instructions Architecture (CPU Type) Who Can Install
For Linux x64 systems: jdk- 11 .interim.update.patch_linux-x64.tar.gz Installing the 64-Bit JDK on Linux Platforms Intel - 64-bit Anyone
For Linux aarch64 (64-bit ARM) systems: jdk- 11 .interim.update.patch_linux-aarch64.tar.gz Installing the 64-Bit JDK on Linux Platforms ARM - 64-bit Anyone
For Linux x64 systems: jdk- 11 .interim.update.patch_linux-x64.deb Installing the 64-Bit JDK Package on Debian-based Linux Platforms Intel - 64-bit RPM-based Linux Root
For Linux x64 systems: jdk- 11 .interim.update.patch_linux-x64.rpm Installing the 64-Bit JDK on RPM-Based Linux Platforms Intel - 64-bit RPM-based Linux Root
For Linux aarch64 (64-bit ARM) systems: jdk- 11 .interim.update.patch_linux-aarch64.rpm Installing the 64-Bit JDK on RPM-Based Linux Platforms ARM - 64-bit RPM-based Linux Root

Installing the 64-Bit JDK on Linux Platforms

You can install the JDK for 64-bit Linux from an archive file ( .tar.gz ). The .tar.gz archive file (also called a tarball) is a file that can be uncompressed and extracted in a single step.

To install the 64-bit JDK on a Linux platform:
  1. Download the required file:

Before you download a file, you must accept the license agreement. Anyone (not only root users) can install the archive file in any location having write access.

$ tar zxvf jdk- 11 _linux-x64_bin.tar.gz OR $ tar zxvf jdk- 11 _linux-aarch64_bin.tar.gz The Java Development Kit files are installed in a directory named jdk- 11 .interim.update.patch .

Installing the 64-Bit JDK Package on Debian-based Linux Platforms

You can install the JDK Debian package for 64-bit Linux from the ( .deb ) file.

To install the 64-bit JDK Debian package on a Linux platform:
  1. Download the required file:
jdk- 11 .interim.update.patch_linux-x64_bin.deb . For example jdk- 11 _linux-x64_bin.deb

Before you download a file, you must accept the license agreement. Anyone (not only root users) can install the archive file in any location having write access.

$ sudo dpkg -i jdk- 11 _linux-x64_bin.deb

The Java Development Kit files are installed into /usr/lib/jvm/jdk- -oracle- directory. For example, JDK 11 releases for x64 will be installed in /usr/lib/jvm/jdk- 11 -oracle-x64 directory.

Installing the 64-Bit JDK on RPM-Based Linux Platforms

You can install the JDK on 64-bit RPM-based Linux platforms, such as Red Hat and SuSE by using a downloadable RPM package file ( .rpm ) in the system location.

You can install the JDK using a downloadable RPM package file on an OL system too, but the preferred way to install the JDK on OL systems is from Oracle Linux RPM repositories.

Ensure that you have the root user access. You can do this by running the command su and entering the superuser password.

To install the 64-bit JDK on an RPM-based Linux platform:
  1. Download the required file:

Before you download a file, you must accept the license agreement.

$ sudo rpm -ivh jdk- 11 _linux-x64_bin.rpm OR $ sudo rpm -ivh jdk- 11 _linux-aarch64_bin.rpm

Upgrade the required package using the following command: $ sudo rpm -Uvh jdk- 11 _linux-x64_bin.rpm OR $ sudo rpm -Uvh jdk- 11 _linux-aarch64_bin.rpm

Note: JDK 11 can coexist with other feature releases of JDK. For each feature release, a separate directory is created, the default directory being /usr/lib/jvm/jdk- -oracle- . For example, JDK 11 releases for x64 will be installed in /usr/lib/jvm/jdk- 11 -oracle-x64 directory.

It is not required to reboot.
Installation of Public Key on RPM-based Linux Platforms

From JDK version 8, the JDK RPMs are signed with OL keys. RPMs installed on Linux distributions other than OL may display a warning message indicating that security validation of the package failed. This indicates that the public key used to sign this RPM needs to be installed in the system.

A sample warning message and the public key installation steps are as follows:

Sample Warning Message

jdk-11.0.23_linux-aarch64_bin.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
  1. Download the key file from https://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 using the following command:
wget https://yum.oracle.com/RPM-GPG-KEY-oracle-ol7
sudo rpm --import RPM-GPG-KEY-oracle-ol7

Public key installation needs to be done only once. The key installation is persistent across reboots.

Installing the 64-Bit JDK on Oracle Linux Platforms

There are two OL-specific JDK RPM packages, jdk- 11 -headless and jdk- 11 -headful . When these packages are installed together, they provide full JDK functionality.

Install jdk- 11 -headless package if you only need headless Java Runtime for running non-GUI applications.

Install jdk- 11 -headful package if you need full JDK functionality for running any Java application and development.

The jdk- 11 -headful package depends on jdk- 11 -headless , hence installing jdk- 11 -headful package will result in the automatic installation of jdk- 11 -headless , if it is not installed yet.

To install the 64-bit JDK headless on an Oracle Linux platform use either dnf or yum command:

sudo dnf install jdk- 11 -headless

sudo yum install jdk- 11 -headless

To install the 64-bit JDK headful on an Oracle Linux platform use the following command:

sudo dnf install jdk- 11 -headful

sudo yum install jdk- 11 -headful