This set of instructions is for 64bit Java installation
Download Java to the Downloads folder
1 - Open Terminal, copy & paste the following commands
sudo mkdir -p -v /opt/java/64
Press Enter
cd Downloads && tar xvzf ~/Downloads/jre-7u4-linux-x64.tar.gz
Press Enter
sudo mv -v ~/Downloads/jre1.7.0_04 /opt/java/64
Press Enter
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/jre1.7.0_04/bin/java" 1
Press Enter
sudo update-alternatives --set java /opt/java/64/jre1.7.0_04/bin/java
Press Enter
mkdir -v ~/.mozilla/plugins
Press Enter
Now remove the IcedTea plugin, if it has been installed. If it's not there to begin with, you'll see a notification of that.
sudo apt-get remove icedtea6-plugin
Press Enter
Remove a former version of the Java plugin (may or may not be present, run the command just to make sure). If it's not there to begin with, you'll see a notification of that.
rm -v ~/.mozilla/plugins/libnpjp2.so
Press Enter
ln -s /opt/java/64/jre1.7.0_04/lib/amd64/libnpjp2.so ~/.mozilla/plugins/
Press Enter
These instructions were copied verbatim from the Easy Linux Tips Project
I have used these instructions myself and can verify that they do work.
Easy Linux Tips - Installing Oracle Java