This topic describes the installation procedures of the JDK on the Linux platform, along with the system requirements.
This topic includes the following sections:
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.
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.
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.
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.
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.
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 (the java.util.prefs
Java package) is configured in the /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
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".
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:
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:
The |
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 The |
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.
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 |
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:
jdk-8uversion-linux-x64.tar.gz
. For example, jdk-8u381-linux-x64.tar.gz
jdk-8uversion-linux-aarch64.tar.gz
. For example, jdk-8u381-linux-aarch64.tar.gz
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.
Change the directory to the location where you want to install the JDK, then move the .tar.gz
archive file to the current directory.
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
.
Delete the .tar.gz
file if you want to save disk space.
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:
su
and entering the superuser password.To install the JDK on an RPM-based Linux platform:
jdk-8uversion-linux-x64.rpm
. For example, jdk-8u381-linux-x64.rpm
jdk-8uversion-linux-aarch64.rpm
. For example, jdk-8u381-linux-aarch64.rpm
jdk-8uversion-linux-i586.rpm
. For example, jdk-8u381-linux-i586.rpm
Before you download a file, you must accept the license agreement.
$ 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.
.rpm
file if you want to save disk space. It is not required to reboot.
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.
jdk-1.8-headless
package if you only need
headless Java Runtime for running non-GUI applications.
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:
sudo dnf install jdk-1.8-headless
sudo yum install jdk-1.8-headless
To install the 64-bit headful JDK on an Oracle Linux platform, use one of the following commands:
sudo dnf install jdk-1.8-headful
sudo yum install jdk-1.8-headful
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