Installing and configuring JRE on Ubuntu

Reading Time: 2 minutes

On your keyboard press on CTRL+ALT+T to reach terminal screen, first of all we will purge open jdk on ubuntu, to achieve this please execute the command below

sudo apt-get purge openjdk*

When we purge the open jdk we can now navigate to Oracle’s official web site to obtain the JRE package. The link could be outdated you may use Google instead.

The never versions may come up, please be aware as long as you are using the 7th version, update versions may change, you can keep it uptodate. We need the Linux packages and the “tar.gz” compression type as well. I am running an x64 architecture version of Ubuntu, if you are on x32 then choose that architecture type.

When we are all good with the download switch to the terminal screen and navigate to the folder where you’ve downloaded the JRE package. First of all we will need to unpack the file, please execute the command below:

tar -zxvf jre-7u45-linux-x64.tar.gz

type the “ls -a” command to make sure the package has been decompressed perfectly. To move on, we need to make the new folder for JRE. I am picking a general-use-location for keeping the software you may want to keep it in a different location. Execute the command to create the folder

sudo mkdir -p /usr/lib/jvm/jre1.7.0

and then migrate all the files and folders we have uncompressed:

sudo mv jre1.7.0_45/* /usr/lib/jvm/jre1.7.0/

we now need to execute the below command to meet ubuntu with JRE:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0/bin/java 0

We are now all setup, there is one more point i would like to go further is that if you are using Firefox, to set JRE up for the browser execute the below command to make a new folder for the plugin

mkdir ~/.mozilla/plugins

and we need to link the file to the newly created folder there are 2 differences for x32 and x64 architectures, i am separately giving the commands


ln -s /usr/lib/jvm/jre1.7.0/lib/i386/ ~/.mozilla/plugins/


ln -s /usr/lib/jvm/jre1.7.0/lib/amd64/ ~/.mozilla/plugins/

To test and validate our JRE installation you may browse this link to find out about the installation

Leave a Reply

Your email address will not be published. Required fields are marked *