How to install Java JRE and JDK from RPM file on Linux
JRE stands for Java Runtime Environment.
JDK stands for Java Development Kit.
In most cases, if you want to run a Java application, you just need to install only the JRE.
But, if you are doing any work of developing or compiling an application that requires the Java SDK, then you need to install the JDK.
This tutorial explains how to install JRE only, JDK and JRE only, and along with JDK.
Download Java 8 JRE only
Latest Java 8 is available for download from here… Click on the Download link next to JRE.
Here is the direct download link Download JRE 8…
Click on the radio button that says “Accept the license agreement.” The radio button will disappear and you will see this message: Thank you for accepting the Oracle Binary Code License Agreement for Java SE; You can now download this software.
For 64-bit Linux, download the JRE file 8u131-linux-x64.rpm located in “Linux x64”
for 32-bit Linux, download the JRE file 8u131-linux-i586.rpm located in “Linux x86”
Installing Java 8 JRE only
Java is not currently installed on this server.
# java -version -bash: java: command not found # rpm -qa | grep -i jre
Install the downloaded rpm JRE 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...
Make sure it is installed successfully. In this example, as we can see, this is Java 1.8.0 installed.
# 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
Download Java 8 JDK only
If you are installing the JDK, as a rule, you do not need to install the JRE separately, since all the binaries included in the JRE are also included in the JDK.
Latest Java 8 available for download here… Click on the Download link next to JDK.
Here is the direct download link JDK 8 Download…
Click on the radio button that says “Accept the license agreement.” The radio button will disappear and you will see this message: Thank you for accepting the Oracle Binary Code License Agreement for Java SE; You can now download this software.
For 64-bit Linux, download the jdk-8u131-linux-x64.rpm file located in “Linux x64”
for 32-bit Linux, download the jdk-8u131-linux-i586.rpm file located in “Linux x86”
Installing Java 8 JDK only
Install Java-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 rpm JDK is installed successfully.
# 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 the JRE and JDK to the / usr / java directory as shown below.
# ls -l /usr/java/ lrwxrwxrwx. 1 root root 16 Jun 1 11:57 default -> /usr/java/latest drwxr-xr-x. 9 root root 4096 Jun 1 12:02 jdk1.8.0_131 drwxr-xr-x. 7 root root 4096 Jun 1 11:57 jre1.8.0_131 lrwxrwxrwx. 1 root root 22 Jun 1 12:02 latest -> /usr/java/jdk1.8.0_131
The output of the ls command above indicates that you can install multiple versions of the JRE or JDK on the same machine, as each install will have its own directory name with a version number in it.
Java executables are used from the JRE location (not from the JDK location).
If you have installed multiple Java, to determine which version of Java executable is used for the whole system, follow these steps:
As shown below, Java executable points to / usr / bin / java
# whereis java java: /usr/bin/java /usr/share/man/man1/java.1
/ usr / bin / java actually points to Java in the / etc / alternatives directory.
# ls -l /usr/bin/java lrwxrwxrwx. 1 root root 22 Jun 1 17:03 /usr/bin/java -> /etc/alternatives/java
And finally, as you can see here, the Java alternative points to the executable from the Java 8 JRE that we just installed. (in the /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