Would you like to learn how to install Java JRE on Ubuntu Linux? In this tutorial, we are going to show you how to install Java JRE using the command-line of a computer running Ubuntu Linux version 17.
Hardware List:
The following section presents the list of equipment used to create this Ubuntu Linux tutorial.
Every piece of hardware listed above can be found at Amazon website.
Ubuntu Playlist:
On this page, we offer quick access to a list of videos related to Ubuntu Linux.
Don’t forget to subscribe to our youtube channel named FKIT.
Ubuntu Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Ubuntu linux.
Tutorial – Java JRE on Ubuntu Linux
On the Linux console, use the following commands to install Java JRE.
# apt-get update
# apt-get install default-jre
Use the following command to find the Java JRE installation directory.
# update-alternatives –config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Nothing to configure.
In our example, our Java JRE is installed under the folder: /usr/lib/jvm/java-8-openjdk-amd64
Now, you need to create an environment variable named JAVA_HOME.
Let’s create a file to automate the required environment variables configuration.
# vi /etc/profile.d/java.sh
Here is the java.sh file content.
#/bin/bash
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Now, let’s reboot the computer.
# reboot
Use the following command to verify if the JAVA_HOME variable was created.
# env | grep JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Use the following command to test the Java JRE installation.
# java -version
openjdk version “1.8.0_162”
OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)