- 6 JDK Installation for Linux Platforms
- General Notes About Installing the JDK on Linux Platforms from Archive Files
- Root Access
- Overwriting Files
- System Preferences
- General Notes About Installing the JDK on Linux Platforms from RPM Packages
- Root Access
- System Preferences
- System Integration
- System Requirements for Installing JDK on Linux Platforms
- Installing the JDK on Linux from Archive Files, RPM Packages and Oracle Linux Repositories
- Downloading the JDK Installer
- Installing the JDK on Linux Platforms
- Installing the JDK on RPM-Based Linux Platforms
- Installing the 64-Bit JDK on Oracle Linux Platforms
- Installation of Public Key on RPM-based Linux Platforms
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:
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:
- From archive files ( .tar.gz ): This enables you to install a private version of the JDK for the current user into any location, without affecting other JDK installations. However, it may involve manual steps to get some of the features to work.
- From downloadable RPM packages ( .rpm ): This enables you to perform a system-wide JDK installation on RPM-based Linux platforms for all users, and requires root access.
- From Oracle Linux repositories: This enables you to perform a system-wide JDK installation on OL platforms starting from OL7 for all users, and requires root access. JDK RPM packages in Oracle Linux RPM repositories are available for x64 and aarch64 (64-bit ARM) OL platforms. Explicit download of JDK RPM packages is not required; the package manager will do it automatically for you.
JDK RPM packages for Generic Linux platforms and Oracle Linux platforms differ. The following table lists the differences:
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.
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.
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:
- Download the required file:
- For Linux x64 systems: jdk-8uversion-linux-x64.tar.gz . For example, jdk-8u381-linux-x64.tar.gz
- For Linux aarch64 (64-bit ARM) systems: jdk-8uversion-linux-aarch64.tar.gz . For example, jdk-8u381-linux-aarch64.tar.gz
- For 32-bit Linux systems: jdk-8uversion-linux-i586.tar.gz . For example jdk-8u381-linux-i586.tar.gz
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.
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.
- 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 JDK on an RPM-based Linux platform:
- Download the required file:
- For x64 systems: jdk-8uversion-linux-x64.rpm . For example, jdk-8u381-linux-x64.rpm
- For aarch64 (64-bit ARM) systems: jdk-8uversion-linux-aarch64.rpm . For example, jdk-8u381-linux-aarch64.rpm
- For 32-bit systems: jdk-8uversion-linux-i586.rpm . For example, jdk-8u381-linux-i586.rpm
Before you download a file, you must accept the license agreement.
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.
- Install the jdk-1.8-headless package if you only need headless Java Runtime for running non-GUI applications.
- Install the jdk-1.8-headful package if you need full JDK functionality for running any Java application and development.
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:
- 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
- Install the key using the following command: sudo rpm —import RPM-GPG-KEY-oracle-ol8