Tuesday, May 13, 2014

Ubuntu Server 14.04 - Install Oracle JDK 1.7.x

Following steps to install Oracle JDK 1.7.x


In this tutorial supposed that we downloaded file "jdk-7u55-linux-i586.tar.gz" and copied it into the user home path by WinSCP or another tool like WinSCP.

1. Extract file
1
$ tar xvzf jdk-7u55-linux-i586.tar.gz

2. Create java directory under /usr/local
1
2
$ cd /usr/local/
$ mkdir java

3. Copy the Oracle Java binaries into the /usr/local/java directory
1
$ cp -r /home/USER/jdk1.7.0_55 /usr/local/java
Replace USER with your name

4. Edit the system PATH file /etc/profile and add the following system variables to your system path
1
$ vi /etc/profile

5. Add the following lines below to the end of your /etc/profile file
1
2
3
4
JAVA_HOME=/usr/local/java/jdk1.7.0_55
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
Write and quit (:wq)

6. Tell the system that the new Oracle Java version is available for use in a new path
1
$update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_55/bin/javac" 1

7. Reload your system wide PATH /etc/profile
1
$. /etc/profile

8. Test the new path
1
$java -version

If we see the result like below, the Oracle Java was installed correctly

1
2
3
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode)

0 comments:

Post a Comment