After downloading the latest .tar file I ran tar zxvf jdk-7u45-linux-x64.tar.gz to extract java files.
tar zxvf jdk-7u45-linux-x64.tar.gz
Set the path in .bashrc file (
.bashrc
Try typing the following in your terminal.
sudo update-alternatives --config java
The output will be some choices and you can select the correct one which installed to your computer.