Linux - Java Runtime Environment
Java Runtime Environment
A Java Runtime Environment, or JRE, is a software package that contains what is required to run a Java program. It includes a Java Virtual Machine implementation together with an implementation of the Java Class Library.
A Java virtual machine, or JVM, is an abstract computing machine that enables a computer to run a Java program. There are three notions of the JVM: specification, implementation, and instance. The specification is a document that formally describes what is required of a JVM implementation. Having a single specification ensures all implementations are interoperable. A JVM implementation is a computer program that meets the requirements of the JVM specification. An instance of a JVM is an implementation running in a process that executes a computer program compiled into Java bytecode.
The Java Development Kit, or JDK, is a superset of a JRE and contains tools for Java programmers, e.g. a javac compiler. The Java Development Kit is provided free of charge either by Oracle Corporation directly, or by the OpenJDK open source project, which is governed by Oracle.
To determine if Java is installed on Linux, use the following command:
whereis java
whereis
locates source/binary and manuals sections for
specified files. The supplied names are first stripped of leading
pathname components and any (single) trailing extension of the form
“.ext
”, for example, “.c
”. Prefixes of
“s.
” resulting from use of source code control are also
handled. whereis
then attempts to locate the desired
program in a list of standard Linux places.
The following example indicates that java is not installed:
>whereis java >
It may be necessary to verify that the JRE was not installed by RPM. To verify this state, use these instructions.
Acquire an RPM file from the Oracle website (try http://java.com/en/download/manual.jsp).
Here is a script that can be used to bypass the Oracle license agreement:
wget --no-cookies \ --no-check-certificate \ --header "Cookie: oraclelicense=accept-securebackup-cookie" \ "http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jre-8u144-linux-x64.rpm" \ -O jdk-7-linux-x64.rpm
Select a directory to install the JRE. In this example, we will use
/opt/t7iw/java
.
Check to see if the directory /opt/t7iw/java
exists.
If it does not already exist, create it with:
mkdir /opt/t7iw/java
Copy the RPM file to the directory /opt/t7iw/java
.
cp *.rpm /opt/t7iw/java
Install the RPM with the following command:
rpm -ivh jre-8u121-linux-x64.rpm
Here is the output from that command:
Preparing... ################################# [100%] Updating / installing... 1:jre1.8.0_121-1.8.0_121-fcs ################################# [100%] Unpacking JAR files... plugin.jar... javaws.jar... deploy.jar... rt.jar... jsse.jar... charsets.jar... localedata.jar...
It should now be installed. To check, use the following command:
java -version
Here is the output:
java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)