Install Proprietary Java on Ubuntu

In Java, Linux, Ubuntu on 13/01/2013 by pier0w

To install the proprietary (non-open) version of Java on Ubuntu just follow these steps.

  1. Download Java.
  2. Extract it.
  3. #> cd /opt
    #> sudo tar xzf ~/jre-<version>-linux-i586.tar.gz
    #> sudo ln -s jre1.<version>/ jre
  4. Add the new java binary to the Ubuntu Java alternatives.
  5. #> sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jre/bin/java" 1
  6. Lastly switch Ubuntu to use the newly intalled Java.
  7. #> 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-6-openjdk-i386/jre/bin/java   1061      auto mode
      1            /opt/jre/bin/java                               1         manual mode
      2            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      manual mode
    Press enter to keep the current choice[*], or type selection number: 1
    #> java -version
    java version "1.<version>"
    Java(TM) SE Runtime Environment (build 1.<version>)
    Java HotSpot(TM) Client VM (build <build>, mixed mode)

It is also a good idea to set up the JAVA_HOME global environemnt variable.

#> sudo vim /etc/profile.d/
export JAVA_HOME=/opt/jre

To pick up the environment variable either restart or dot in the /etc/profile file.

#> . /etc/profile

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: