To install java in your machine follow these steps. This documentation cover installation and enabling java for browser. Download jre-7u5-linux-x64 from here. Put it in Downloads folder.
Open a terminal. Copy/Paste
Remove any perior installation of java.
sudo apt-get purge openjdk-\*
Make directory in /usr/local/java where this software will install.
sudo mkdir -p /usr/local/java
Now copy jre-7u5-linux-x64.tar.gz into /usr/local/java directory.
cd ~/Downloads
sudo -s cp -r jre-7u5-linux-x64.tar.gz /usr/local/java
Now change directory to*/usr/local/java*
cd /usr/local/java
Change your file permission and extract by typing
sudo -s chmod a+x jre-7u5-linux-x64.tar.gz
sudo -s tar xvzf jre-7u5-linux-x64.tar.gz
Now open /etc/profile file
sudo gedit /etc/profile and copy paste below text at the last of the recent opened file.
JAVA_HOME=/usr/local/java/jdk1.7.0_05
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
JAVA_HOME=/usr/local/java/jre1.7.0_05
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
Now tell your system that you have newly java installed and use it from my installed directory.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.7.0_05/bin/java" 1
sudo update-alternatives --set java /usr/local/java/jre1.7.0_05/bin/java
Reload system profile so that it can use java.
. /etc/profile
Now reboot your system.
Verify that your java is working in here
Now install java plugin for you browser (Firefox & Chrome).
Chrome
cd /opt/google/chrome/plugins
sudo ln -s /usr/local/java/jre1.7.0_05/lib/i386/libnpjp2.so
Firefox
sudo mkdir -p /usr/lib/mozilla/plugins
cd /usr/lib/mozilla/plugins
sudo ln -s /usr/local/java/jre1.7.0_05/lib/i386/libnpjp2.so
java -version this will give you what java do you have.