How to instal JRE 7 in Ubuntu 12

First step is clean all openjdk from system

sudo apt-get purge openjdk*

Now download latest JRE version from here http://www.oracle.com/technetwork/java/javase/downloads/jre-7u13-download-1501631.html. Download package: jre-7u13-linux-i586.tar.gz.

Download package to ~/Downloads and execute following commands

tar -xvf ~/Downloads/jre-7u13-linux-i586.tar.gz
sudo mkdir -p /usr/lib/jvm/jre1.7.0
sudo mv jre1.7.0_13/* /usr/lib/jvm/jre1.7.0/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0/bin/java 0

External links

http://www.liberiangeek.net/2012/04/install-oracle-java-runtime-jre-7-in-ubuntu-12-04-precise-pangolin/