티스토리 뷰

OS/CentOS

How to install JDK 6 using wget/curl

kkd927 kkd927 2014.07.28 14:26


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



댓글