Ubuntu 14.04 jdk8 설치하기
$ cd /opt
$ sudo 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/8u20-b26/jdk-8u20-linux-x64.tar.gz"
$ sudo tar -zxvf jdk-8u20-linux-x64.tar.gz
$ sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_20/bin/java 2
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /opt/jdk1.8.0_20/bin/java 2 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
Press enter to keep the current choice[*], or type selection number: 1
$ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_20/bin/javac 2
$ sudo update-alternatives --config javac
$ sudo update-alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_20/bin/jar 2
$ sudo update-alternatives --config jar
$ sudo vi .bashrc
export JAVA_HOME=/opt/jdk1.8.0_20
export JRE_HOME=/opt/jdk1.8.0_20/jre
export PATH=$PATH:/opt/jdk1.8.0_20/bin:/opt/jdk1.8.0_20/jre/bin
$ echo $JAVA_HOME
$ echo $JRE_HOME