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.
Every update release is installed in a separate directory
named /usr/lib/jvm/jdk-version-oracle-arch
,
where version
is a full version string
(for example, 1.8.0_421
), and arch
is either x64
(64-bit systems), aarch64
(64-bit ARM systems), or x86
(32-bit systems). In addition,
two symbolic links named
/usr/java/jdk1.8.0-arch
and
/usr/java/jdk-1.8-oracle-arch
that point to the
installation directory are 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-version-oracle-arch |
/usr/lib/jvm/jdk-version-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: Different feature and update releases
of the JDK can coexist. Every feature and update release is
installed in a separate directory named
/usr/lib/jvm/jdk-version-oracle-arch
.
For example, JDK 8u421 for x64 will be installed in a directory
named /usr/lib/jvm/jdk-1.8.0_421-oracle-x64
.
.rpm
file if you want to save disk space. It is not required to reboot.
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:
If you have installed the stub RPM package jdk1.8
and would like to downgrade it to 8u361 or an earlier version, you must
manually uninstall the jdk-1.8
RPM package before the downgrade
to prevent the side-by-side installation of earlier and later JDK 8 RPM
packages.
If the jdk-1.8
RPM package is stored in an RPM repository,
then you must add the stub jdk1.8
RPM package alongside
the jdk-1.8
RPM package in the same RPM repository.
If you are upgrading JDK 8u361 or earlier from a jdk1.8
RPM package to later version from a jdk-1.8
RPM package,
and you're not using an RPM repository, then you must specify the paths
to the jdk1.8
and jdk-1.8
RPM packages in a single
update command.
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