Skip to content

Instantly share code, notes, and snippets.

@iarrup
Created April 24, 2017 21:13
Show Gist options
  • Save iarrup/4f472b84a6327aac142d70b024d9785a to your computer and use it in GitHub Desktop.
Save iarrup/4f472b84a6327aac142d70b024d9785a to your computer and use it in GitHub Desktop.
#Download Java
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz"
sudo mv jdk-8u121-linux-x64.tar.gz /opt/
sudo tar xvfz jdk-8u121-linux-x64.tar.gz
#Setup alternatives
cd /opt/jdk1.8.0_121/
alternatives --install /usr/bin/java java /opt/jdk1.8.0_121/bin/java 2
alternatives --config java
#select the right option
# Setup alternatives for javac and jar
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_121/bin/javac 2
alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_121/bin/jar 2
alternatives --set jar /opt/jdk1.8.0_121/bin/jar
alternatives --set javac /opt/jdk1.8.0_121/bin/javac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment