Skip to content

Instantly share code, notes, and snippets.

@towfiqpiash
Last active July 26, 2018 07:20
Show Gist options
  • Save towfiqpiash/6a0c39d042d74b0803360d40060018b7 to your computer and use it in GitHub Desktop.
Save towfiqpiash/6a0c39d042d74b0803360d40060018b7 to your computer and use it in GitHub Desktop.
When apt-get installing oracle java 7 stopped working, try this

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment