Documentation Contents
Java Platform, Standard Edition Installation Guide
Contents    Previous    Next

6 JDK Installation for Linux Platforms

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

This topic includes the following sections:

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

Installing the JDK automatically creates a directory named /usr/lib/jvm/jdk-1.8-oracle-arch, where arch is either x64 (64-bit systems), aarch64 (64-bit ARM systems), or x86 (32-bit systems), depending on the architecture of your system.

Root Access

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 subdirectory for which you have write permissions.

Overwriting Files

If you install the software in a directory that contains a subdirectory named jdk-1.8-oracle-arch, the installer 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.

System Preferences

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

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

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 8u371 and JDK 8u381 simultaneously. If you attempt to install JDK 8u381 after JDK 8u 371 is installed, the installer uninstalls JDK 8u371 and installs JDK 8u381.

All versions of JDK of the same feature release are installed in /usr/lib/jvm/jdk-1.8-oracle-arch, where arch is either x64, aarch64, or x86, depending on the architecture of your system. Additionally, a symbolic link named /usr/java/jdk1.8.0-arch pointing to the installation directory is created for backward compatibility.

Note: 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.

Root Access

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

System Preferences

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

System Integration

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 8 and JRE 8 Certified System Configurations for information about supported platforms, operating systems, and browsers.

On a 64-bit system, you can download either the 64-bit or the 32-bit version of the Java platform. However, if you are using a 32-bit browser and you want to use the plugin, then you need to install the 32-bit version of the Java platform. To determine which version of Firefox you are running, launch the application, and select the menu item Help -> About Mozilla Firefox. At the bottom of the window is a version string line that contains either "Linux i686" (32-bit) or "Linux x86_64" (64-bit). To setup the Java plugin, see "Manual Installation and Registration of Java Plugin for Linux".

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

You can install the JDK on a Linux platform from archive files, 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:

Feature Downloadable JDK RPM Package for Generic Linux Platforms JDK RPM package for Oracle Linux platforms
Supported Linux Platforms Any RPM-based Linux platform. For example, Red Hat, SuSE OL platforms starting from OL7
Package name The JDK image is packed in a single package named jdk-1.8.

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

  • jdk-1.8-headless is a headless Java Runtime for running non-GUI applications.
  • jdk-1.8-headful is headful Java Runtime and Development Kit for developing and running all types of applications.

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

Installation directory name /usr/lib/jvm/jdk-1.8-oracle-arch /usr/lib/jvm/jdk-1.8-oracle-arch
Available for download from Java SE Downloads Yes No. The packages are hosted in Oracle Linux RPM repositories.
Integration with the alternatives framework The jdk-1.8 package registers java and javac groups with the alternatives framework.

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

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

Will automatically install the required third-party packages? No. You need to manually install the required packages. Yes. All required packages will be installed automatically.

Note: When you download and install the JDK, the associated Java Runtime Environment (JRE) is also installed.

Downloading the JDK Installer

Access the Java 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 JDK 8 on a Linux platform:

Download File Instructions Architecture (CPU Type) Who Can Install
Linux x64 systems: jdk-8uversion-linux-x64.tar.gz Installing the JDK on Linux Platforms Intel - 64-bit Anyone
Linux aarch64 (64-bit ARM) systems: jdk-8uversion-linux-aarch64.tar.gz Installing the JDK on Linux Platforms ARM - 64-bit Anyone
32-bit Linux systems: jdk-8uversion-i586.tar.gz Installing the JDK on Linux Platforms Intel - 32-bit Anyone
Linux x64 systems: jdk-8uversion-linux-x64.rpm Installing the JDK on RPM-Based Linux Platforms Intel - 64-bit RPM-based Linux Root
Linux aarch64 (64-bit ARM) systems: jdk-8uversion-linux-aarch64.rpm Installing the JDK on RPM-Based Linux Platforms ARM - 64-bit RPM-based Linux Root
32-bit Linux systems: jdk-8uversion-linux-i586.rpm Installing the JDK on RPM-Based Linux Platforms Intel - 32-bit RPM-based Linux Root

Installing the JDK on Linux Platforms

You can install the JDK for 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.

  2. Change the directory to the location where you want to install the JDK, then move the .tar.gz archive file to the current directory.

  3. Unpack the tarball and install the downloaded JDK:

    $ tar zxvf jdk-8uversion-linux-arch.tar.gz

    The Java Development Kit files are installed in a directory named jdk-1.8-oracle-arch.

  4. Delete the .tar.gz file if you want to save disk space.

Installing the JDK on RPM-Based Linux Platforms

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

Note:

To install the JDK on an RPM-based Linux platform:

  1. Download the required file:

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

  2. Install the required package using the following command:

    $ sudo rpm -ivh jdk-8uversion-linux-arch.rpm

    Upgrade the required package using the following command:

    $ sudo rpm -Uvh jdk-8uversion-linux-arch.rpm

    Note: JDK 8 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-1.8-oracle-arch. For example, JDK 8 releases for x64 will be installed in /usr/lib/jvm/jdk-1.8-oracle-x64 directory.

  3. Delete the .rpm file if you want to save disk space. It is not required to reboot.

Maintaining and Upgrading Java 8u361 and Earlier RPM Packages

In 8u371, the RPM package names for the JDK and JRE were changed from jdk1.8 to jdk-1.8 and jre1.8 to jre-1.8, respectively.

To enable automatic upgrades from earlier Java 8 RPM packages. the Obsoletes tag was added. However, in 8u421, this tag has been removed, and new stub RPM packages named jdk1.8 and jre1.8 have been added. Consequently, if you have installed JDK or JRE 8u361 or earlier from RPM packages, then you must perform additional steps to enable upgrades from these earlier versions and downgrades to these versions.

These steps also apply to the jre1.8 and jre-1.8 RPM packages:

Installing the 64-Bit JDK on Oracle Linux Platforms

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

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

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

To install the 64-bit headful JDK on an Oracle Linux platform, use one of the following commands:

Installation of Public Key on RPM-based Linux Platforms

The JDK RPMs are signed with OL keys. Installation of these RPMs on Linux distributions other than OL gives a warning message indicating that security validation of the package fails. This indicates that the public key used to sign this RPM needs to be installed in the system. The following is a sample warning message:

jdk-8u281-ea-bin-b03-linux-amd64-20_oct_2020.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY

The following are the public key installation steps:

  1. Download the key file from https://yum.oracle.com/RPM-GPG-KEY-oracle-ol8 using the following command:

    wget https://yum.oracle.com/RPM-GPG-KEY-oracle-ol8

  2. Install the key using the following command:

    sudo rpm --import RPM-GPG-KEY-oracle-ol8

Contents    Previous    Next

Oracle and/or its affiliates Copyright © 1993, 2024, Oracle and/or its affiliates. All rights reserved.
Contact Us