- Download Oracle JDK 7 ( https://drive.google.com/open?id=0By2z9yKS_uQXcVB5THBHcE1iRlU ). Go to downloaded location.
- Run this command
sudo mv jdk-7u(downloadedversion)-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/
- Run
sudo apt-get install -y oracle-java7-installer
again. It should work now!
Or,
Install Oracle JDK 7 We assume that you already downloaded jdk-7u80-linux-x64.tar.gz file from Java archive download page.
Extract the downloaded file.
$ tar xzf jdk-7u80-linux-x64.tar.gz
the command above will extract contents of jre compressed archive under jre1.7.0_80 directory.
Move this directory to /opt. We will install Oracle JDK 7 to /opt since this directory is reserved for application not shipped with operating system itself.
$ sudo mv jdk1.7.0_80/ /opt/
Change the ownership of the directory and all of its contents to user root and group root.
$ sudo chown -R root:root /opt/jdk1.7.0_80/
Add the jdk 7 as default java
$ sudo update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_80/bin/java 100
Now choose from terminal if you have multiple version of java installed:
$ sudo update-alternatives --config java