How to Install Java on Ubuntu

OpenJDK

To Install OpenJDK 7 Runtime on Ubuntu, simply we can execute the following command.

sudo apt-get install openjdk-7-jre

Install Firefox / Chromium OpenJDK plugin:

sudo apt-get install icedtea-plugin


If you prefer Java (Sun JDK 7) continue reading. You'll also see how to enable Java plugin for Firefox and Chromium.

Installing Sun Java on Ubuntu 12.04 (64-bit)

  • I downloaded  jdk-7u4-linux-x64.tar.gz file from oracle.com
     
  • Using the terminal I goto download folder and extract the tar file content.

$ cd ~/Downloads
$ tar -xvzf jdk-7u4-linux-x64.tar.gz

  • Then I moved the extracted folder to /usr/lib/jvm/

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

  • Then I installed the files.

$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_04/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_04/bin/java 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_04/bin/javaws 1

  • Then I chosed which will default. (For example I have open java installed. But I chosed the new one which is ..jvm/jdk1.7.0_04/... )

$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws

  • I checked the version of java (not necessary, just for information):

$ java -version

Enable Java plugin for Firefox and Chromium in Ubuntu 12.04 (64-bit)

After installing java, by the following command I activated java plugin for Firefox and also for Chromium browser.

$ sudo ln -s /usr/lib/jvm/jdk1.7.0_04/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins

After restarting the browser I see the plugin working by visiting java test page on java.com

Reference: 

Share Share Editor: editor | Posted: 2012/06/12 | Views: 15355

Comments

7 + 3 =
Home | Search | Contact | Terms
Editor
radyo dinle aşı takvimi podcast multimedia blog bedava dinle izle kongreler online müzik dinle selected videos nasheed music videos