How to install Oracle Java JDK in ubuntu

This quick short tutorial explains you how to install oracle java jdk in your ubuntu linux. Oracle java jdk is available as source code. Unfortunately there is no debian package to download from oracle website. Dont worry! We can use the source code and install it.

First check your linux architecture


64 bit linux — x86_64

32 bit linux — i386 or i586

Go to oracle website and download oracle java jdk source code.

oracle java, java download, oracle java download, java jdk, oracle java jdk

Click JDK Download.

oracle java, java download, setup java in linux, oracle jdk, oracle java jdk

Read the license agreement carefully and go ahead. Download Linux x86 if your system is 32bit or Linux x64, if your system is 64bit.

jdk-7u9-linux-x64.tar.gz – 64 bit java

jdk-7u9-linux-i586.tar.gz – 32 bit java

Alternative method to download java using wget method in command line


mv jdk-7u9-linux-x64.tar.gz?AuthParam=1341060304_96e260b78fd3b2a30f05f235315217 jdk-7u9-linux-x64.tar.gz

Extract it

mkdir /usr/local/jvm/

tar -xvf jdk-7u9-linux-x64.tar.gz

mv jdk1.7.0_09 jdk1.7.0

mv jdk1.7.0 /usr/lib/jvm/

Now run update-alternative command to install it

sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/jdk1.7.0/bin/java” 1
sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/lib/jvm/jdk1.7.0/bin/javac” 1
sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/lib/jvm/jdk1.7.0/bin/javaws” 1

If you have other java installed on your machine, run this command

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   1051      auto mode
1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode
2            /usr/lib/jvm/jdk1.7.0/bin/java                   1         manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/jdk1.7.0/bin/java to provide /usr/bin/java (java) in manual mode.

Check Java Version

# java -version
java version “1.7.0_07″
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

Do the same for javac, javaws

sudo update-alternatives –config javac
sudo update-alternatives –config javaws

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Add a Comment

Your email address will not be published. Required fields are marked *