Skip to content

Instantly share code, notes, and snippets.

@kkd927
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkd927/20c0939a6330cc0769e2 to your computer and use it in GitHub Desktop.
Save kkd927/20c0939a6330cc0769e2 to your computer and use it in GitHub Desktop.
How to install JDK 6 using wget/curl (CLI)
# 1. Download JDK 6 using wget/curl (cli)
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/6u45-b06/jdk-6u45-linux-x64.bin"
# 2. Change mode to excute
chmod +x jdk-6u45-linux-x64.bin
# 3. Install JDK6
./jdk-6u45-linux-x64.bin
# 4. Move JDK directory
mv jdk1.6.0_45 /usr/java/jdk1.6.0_45
# 5. Configure the OS to use SUN JDK 6
alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_45/jre/bin/java 20000
alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_45/bin/jar 20000
alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_45/bin/javac 20000
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_45/jre/bin/javaws 20000
alternatives --set java /usr/java/jdk1.6.0_45/jre/bin/java
alternatives --set javaws /usr/java/jdk1.6.0_45/jre/bin/javaws
alternatives --set javac /usr/java/jdk1.6.0_45/bin/javac
alternatives --set jar /usr/java/jdk1.6.0_45/bin/jar
#6. Register JDK path
echo "export JAVA_HOME=/usr/java/jdk1.6.0_45" >> /root/.bashrc
echo "export JRE_HOME=/usr/java/jdk1.6.0_45" >> /root/.bashrc
source /root/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment