Skip to content

Instantly share code, notes, and snippets.

@CptPlastic
Forked from rjurney/java_install.sh
Created October 3, 2018 16:28
Show Gist options
  • Save CptPlastic/32ef8f1fba4cf59acf5dd014a705770e to your computer and use it in GitHub Desktop.
Save CptPlastic/32ef8f1fba4cf59acf5dd014a705770e to your computer and use it in GitHub Desktop.
How to automagically install Oracle JDK 1.8 on CentOS
# Install Java 1.8 in CentOS/RHEL 6.X
sudo yum remove -y java-1.6.0-openjdk
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-x64.rpm" \
-O jdk-8-linux-x64.rpm
sudo rpm -Uvh jdk-8-linux-x64.rpm
sudo alternatives --install /usr/bin/java java /usr/java/jdk1.8.0/jre/bin/java 20000
sudo alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0/bin/jar 20000
sudo alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0/bin/javac 20000
sudo alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0/jre/bin/javaws 20000
sudo alternatives --set java /usr/java/jdk1.8.0/jre/bin/java
sudo alternatives --set javaws /usr/java/jdk1.8.0/jre/bin/javaws
sudo alternatives --set javac /usr/java/jdk1.8.0/bin/javac
sudo alternatives --set jar /usr/java/jdk1.8.0/bin/jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment