Install Oracle Java JDK in Ubuntu


After installation of Ubuntu, you will notice that it comes prepacked with the OpenJDK environment. This is substantially enough for typical users who wish to develop simple Java programs.

However, there are some Java libraries that are not included or compatible with the OpenJDK environment. Taking Atlassian JIRA as an example that requires the more popular and proprietary Sun Java JDK platform.

Due to its proprietary status, Ubuntu does not include this in its repository. Hence, we would need to install this manually. This post is teaches how to install Oracle Java JDK in Ubuntu.

Installing Sun JDK 7 Update 67 on Ubuntu

  1. Download the jdk-7u67-linux-i586.tar.gz from the Sun Java Download Centre. If you are on 64-bit Ubuntu, you should grab jdk-7u67-linux-x64.tar.gz.
  2. Extract the tar file:
    tar -xvzf jdk-7u67-linux-x64.tar.gz
  3. Move extracted folder to this location:
    sudo mv jdk1.7.0_67/ /usr/lib/jvm/
  4. Install the new Java source in system:
    sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_67/bin/javac 1
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_67/bin/java 1
    sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_67/bin/javaws 1
  5. Choose default Java:
    sudo update-alternatives --config javac
    sudo update-alternatives --config java
    sudo update-alternatives --config javaws
  6. Check the Java version:
    java -version
  7. Verify the symlinks all point to the new Java location:
    ls -la /etc/alternatives/java*

Was That a Good Read? Rate It!

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)
Loading ... Loading ...


Add a Comment

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

Current day month ye@r *

CommentLuv badge