≡ Menu

How to Install Java 8 JRE and JDK from RPM file on Linux

Java JRE JDK InstallJRE stands for Java Runtime Environment.

JDK stands for Java Development Kit.

In most situations, if you want to run a Java application, you just need to install Only JRE.

But, if you are doing some development work, or compiling an application that requires Java SDK, then you have to install JDK.

This tutorial explains how to install JRE only, JDK only, and both JRE JDK together.

Download Java 8 JRE Only

The latest version of Java 8 is available for download from here. Click on the “Download” link next to “JRE”.

Here is the direct download link for JRE 8 Download.

Click on the radio-button that says: “Accept License Agreement”. The radio button will disappear and you’ll see this message: Thank you for accepting the Oracle Binary Code License Agreement for Java SE; you may now download this software.

For 64-bit linux, download the jre-8u131-linux-x64.rpm file, which is under “Linux x64”

for 32-bit linux, download the jre-8u131-linux-i586.rpm file, which is under “Linux x86”

Install Java 8 JRE Only

On this server, currently there is no java installed.

# java -version
-bash: java: command not found

# rpm -qa | grep -i jre

Install the downloaded jre rpm file as shown below.

# rpm -ivh jre-8u131-linux-x64.rpm --test
Preparing...                          ################# [100%]

# rpm -ivh jre-8u131-linux-x64.rpm 
Preparing...                          ################# [100%]
Updating / installing...
   1:jre1.8.0_131-1.8.0_131-fcs       ################# [100%]
Unpacking JAR files...
        plugin.jar...
        javaws.jar...
        deploy.jar...
        rt.jar...
        jsse.jar...
        charsets.jar...
        localedata.jar...

Verify to make sure it is installed successfully. In this example, as we see, this has installed the 1.8.0 version of java.

# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

# rpm -qa | grep -i jre
jre1.8.0_131-1.8.0_131-fcs.x86_64

Note: If you are new to Java, and like to learn how to write a simple basic hello world java program, this might help: How To Write and Execute Java Program on Unix OS

Download Java 8 JDK Only

If you are installing JDK, you typically don’t have to install JRE separately as all the binary files that are included with JRE is also included with JDK.

The latest version of Java 8 is available for download from here. Click on the “Download” link next to “JDK”.

Here is the direct download link for JDK 8 Download.

Click on the radio-button that says: “Accept License Agreement”. The radio button will disappear and you’ll see this message: Thank you for accepting the Oracle Binary Code License Agreement for Java SE; you may now download this software.

For 64-bit linux, download the jdk-8u131-linux-x64.rpm file, which is under “Linux x64”

for 32-bit linux, download the jdk-8u131-linux-i586.rpm file, which is under “Linux x86”

Install Java 8 JDK Only

Install the Java 8 JDK on your system as shown below.

# rpm -ivh jdk-8u131-linux-x64.rpm --test
Preparing...                          ################ [100%]
 
# rpm -ivh jdk-8u131-linux-x64.rpm 
Preparing...                          ################ [100%]
Updating / installing...
   1:jdk1.8.0_131-2000:1.8.0_131-fcs  ################ [100%]
Unpacking JAR files...
        tools.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
        rt.jar...
        jsse.jar...
        charsets.jar...
        localedata.jar...

Make sure that the jdk rpm is successfully installed.

# rpm -qa | grep -i jdk
jdk1.8.0_131-1.8.0_131-fcs.x86_64

Java 8 JRE and JDK File Locations

By default, the above steps will install both jre and jdk under /usr/java directory as shown below.

# ls -l /usr/java/
lrwxrwxrwx. 1 root root   16 Jun  1 16:55 default -> /usr/java/latest
drwxr-xr-x. 9 root root 4096 Jun  1 17:03 jdk1.8.0_131
drwxr-xr-x. 7 root root 4096 Jun  1 16:55 jre1.8.0_131
lrwxrwxrwx. 1 root root   22 Jun  1 17:03 latest -> /usr/java/jdk1.8.0_131

The above ls output indicates that you can install multiple versions of jre or jdk on the same machine, as each and every version of the installation will get its own directory name with the version number in it.

The java executable is used from the JRE location (and not from JDK location).

When you have multiple java installed, to identify which version of the java executable is used system-wide, do the following:

As shown below, the java executable is pointing to /usr/bin/java

# whereis java
java: /usr/bin/java /usr/share/man/man1/java.1

The /usr/bin/java is really pointing to the java in /etc/alternatives directory.

# ls -l /usr/bin/java
lrwxrwxrwx. 1 root root 22 Jun  1 17:03 /usr/bin/java -> /etc/alternatives/java

Finally, as you see here, the etc alternatives java is pointing to the java executable from the Java 8 JRE that we installed. (i.e from /usr/java/jre1.8.0_131/bin directory)

# ls -l /etc/alternatives/java
lrwxrwxrwx. 1 root root 31 Jun  1 17:03 /etc/alternatives/java -> /usr/java/jre1.8.0_131/bin/java

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 0 comments… add one }

Leave a Comment