ubuntu

How to install Oracle JDK 7 on ubuntu 12.04

7

For JDK 6 click here : How to install jdk6 on ubuntu

To install Oracle JDK 7 on ubuntu 12.04

1.Go to Oracle JDK7 download page. And download the latest linux jdk in .tar.gz format.
Here its (32 bit) jdk-7u4-linux-i586.tar.gz.

2.Copy your JDK .tar.gz file to your Desktop.

3.Open Terminal.To open terminal click the Dash home from unity launcher.And type terminal in the search field.And click Terminal.

4.Type the below code in terminal and hit enter to extract in Home folder.

tar -xvf ~/Desktop/jdk-7u4-linux-i586.tar.gz


5.Next Type below command in terminal to create a new folder.

sudo mkdir -p /usr/lib/jvm/jdk1.7.0

Type your ubuntu password if needed and press enter.

6.Now type below command to move files.

sudo mv jdk1.7.0_04/* /usr/lib/jvm/jdk1.7.0/

Note:change this (jdk1.7.0_04) according to your jdk version.
Example: for JDK 7 update 5 use jdk1.7.0_05

7.Type below command in terminal and hit enter.

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1

8.Then type below command in terminal and hit enter.

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1

9.Then type below command in terminal and hit enter.

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

10.After the successful installation,to check the installed version type

java -version

If you enjoyed this article, Get email updates (It’s Free)
avatar
Author :  

Hello visitor! Subscribe to the RSS feed or subscribe via email to receive updates.

Browse related articles

Ubuntu 13.10 (Saucy Salamander) Release Schedule Ubuntu 13.10 (Saucy Salamander) Release Schedule

Ubuntu 13.10 (Saucy Salamander) is scheduled for release in  17th October, 2013 Ubuntu 13.10 Release Schedule: Ubuntu 13.10 Alpha 1 – June 20th,2013 Ubuntu 13.10 Alpha 2 – July 18th,2013 Ubuntu 13.10 Alpha 3 – August 1st,2013 Ubuntu 13.10 Beta 1- September 5th,2013 Ubuntu 13.10 Final Beta – September 26th,2013 Ubuntu 13.10 Release Candidate – [...]

Linux 3.9 released Linux 3.9 released

Linux 3.9 is now available for download.What’s new in this release? Fix a build warning Fix missing put_cpu_var() in tlb_batch_add_one() when not batching. do not expose broken video output streams disable -mlong-calls compiler option for kernel modules fix atime/mtime regression Provide __ucmpdi2 to resolve undefined references in 32bit builds. Change kunmap macro to static inline [...]

Ubuntu 13.04 Released Ubuntu 13.04 Released

Ubuntu 13.04 (Raring Ringtail) is now available for download. What’s new in ubuntu 13.04? Linux kernel 3.8.8 Unity user interface changes Unity 7 New interface animations, including window snap Scroll-switching of open windows from Unity Launcher New Social Lens Workspace item removed from launcher A new sync menu for Ubuntu One Upstart 1.8 LibreOffice 4.0 [...]

Ubuntu 13.10 codenamed Saucy Salamander Ubuntu 13.10 codenamed Saucy Salamander

Ubuntu 13.10 gets a codename Saucy Salamander, Canonical founder Mark Shuttleworth revealed on his personal blog post. Ubuntu 13.10 is scheduled for release in  late October, 2013 Source: Salamander wiki If you enjoyed this article, Get email updates (It’s Free) Tweet Pin It

7 Comments on How to install Oracle JDK 7 on ubuntu 12.04

  1. avatar Kurtk says:

    I followed the instructions (on LinxMint 13), but still got:
    # java -version
    java version “1.6.0_24″
    OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3)
    OpenJDK Server VM (build 20.0-b12, mixed mode)
     

    • avatar Seve says:

      Yeah, I’m also funning Linux Mint Maya and got the same thing. Tried typing “sudo update-alternatives –config java” and was presented with a choice between pressing 0 for OpenJDK 1.6 auto m, 1 for OpenJDK 1.6 manual, and 2 for 1.7.0 manual. I pressed 2. Hope that was correct.

  2. avatar linux says:

    you may have to run “sudo update-alternatives –config java” after following these instructions

  3. avatar Judy says:

    A THOUSAND ‘thank you’s for these instructions!!!

  4. avatar Wayne says:

    Thanks so much for these instructions. Worked like a charm!

  5. avatar Manimaran says:

    very thank you so much

Leave a Reply