Skip to content

Instantly share code, notes, and snippets.

@aclisp
Forked from rjurney/java_install.sh
Last active December 8, 2016 10:22
Show Gist options
  • Save aclisp/b1e8d58fba908a650662f244a9a60138 to your computer and use it in GitHub Desktop.
Save aclisp/b1e8d58fba908a650662f244a9a60138 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/latest/jre/bin/java 20000
sudo alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000
sudo alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000
sudo alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000
sudo alternatives --set java /usr/java/latest/jre/bin/java
sudo alternatives --set javaws /usr/java/latest/jre/bin/javaws
sudo alternatives --set javac /usr/java/latest/bin/javac
sudo alternatives --set jar /usr/java/latest/bin/jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment