Here’s a shell script that helps you automate the retrieval, installation and configuration of Oracle (Sun) Java Runtime Environment in Ubuntu. I have tested it in Ubuntu 13.04, 12.10 and prior and it works great. This script downloads, installs and configures everything you need for Oracle Java JRE in Ubuntu.

As you may already know, Oracle withdrew that license that made it possible for Canonical (Ubuntu parent company) to include Java in Ubuntu. Because of that, all Java packages were removed from Ubuntu. The only way to get Java JRE is to manually download the install it or use third party repositories.

Well, instead of manually downloading and installing the latest Java JRE versions (Java JRE 7) in Ubuntu, use this script to automate the process for you. This brief tutorial is going to show you how to enable it in Ubuntu.

To get started, press Ctrl – Alt – T on your keyboard to open the terminal. When it opens, run the commands below to add the script download repository.

sudo sh -c 'echo "deb http://www.duinsoft.nl/pkg debs all" >> /etc/apt/sources.list'

 

java_jre_ubuntu

 

Next, run the commands below to add the repository key.

sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 5CB26B26

 

java_jre_ubuntu_1

 

Finally, run the commands below to update your system and install Oracle Java JRE packages.

sudo apt-get update && sudo apt-get install update-sun-jre

 

java_jre_ubuntu_2

 

That’s it!

 

java_jre_ubuntu_3

 

Everytime there’s an updated version of Java JRE, this script will automatically download and install it for you. No need to worry anymore. The last version of Java JRE as of today is Java JRE 7.

 

Enjoy!