Skip to content

Instantly share code, notes, and snippets.

@sdmcraft
Last active November 12, 2020 11:03
Show Gist options
  • Save sdmcraft/2c5abbdeccf37e1642e5 to your computer and use it in GitHub Desktop.
Save sdmcraft/2c5abbdeccf37e1642e5 to your computer and use it in GitHub Desktop.
Setup java on linux
cd /opt/
yum -y install wget
curl -L -b "oraclelicense=a" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz -O
tar xzf jdk-8u131-linux-x64.tar.gz
cd /opt/jdk1.8.0_131/
alternatives --install /usr/bin/java java /opt/jdk1.8.0_131/bin/java 2
alternatives --config java
alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_131/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_131/bin/javac 2
alternatives --set jar /opt/jdk1.8.0_131/bin/jar
alternatives --set javac /opt/jdk1.8.0_131/bin/javac
echo "export JAVA_HOME=/opt/jdk1.8.0_131" >> ~/.bash_profile
echo "export JRE_HOME=/opt/jdk1.8.0_131/jre" >> ~/.bash_profile
echo "export PATH=$PATH:/opt/jdk1.8.0_131/bin:/opt/jdk1.8.0_131/jre/bin" >> ~/.bash_profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment