ubuntu 14.04 64bit install jdk

Setup environment

operating system: ubuntu 14.04 64bit

Download jdk

Download the latest version of jdk from the official website.

Unzip jdk

Usually, we will create a new folder to hold the unzipped jdk file.

1
sudo mkdir /usr/lib/jvm

Then we unzip jdk we download and copy them to jvm folder

1
sudo tar zxvf jdk-8u60-linux-x64.tar.gz -C /usr/lib/jvm

Next, we need to configure environment variables.

1
2
3
4
5
6
7
8
9
10
11
//open the user environment variable file
sudo gedit ~/.bashrc


//add the content at the end of ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

//make the file in effect
source ~/.bashrc

Then we can make test.

1
java -version

If succeed, the results will be look like as follows:

1
2
3
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)