Onur Özgür ÖZKAN

Php, Ruby, Kebab, Git Geek

Install Sun Java JDK on Ubuntu

I usually use open source software but sometimes we haven’t choice. When i started to use PhpStorm IDE, i got notification over Performans Issue over Open JDK. Yes i also don’t believe it. PhpStorm offered me that Sun JDK instead of Open JDK. So i decided that switch Sun JDK. This short post is helped us how to install Sun JDK on Ubuntu.

First we need to check that Ubuntu Partners repository is enabled in our apt source list, open /etc/apt/sources.list and uncomment the following line: deb http://archive.canonical.com/ubuntu maverick partner

Of course this is over Ubuntu 10.10 Maverick Meerkat. You can find the correct line in your version.

Then in command line type

1
2
sudo apt-get update
sudo apt-get install sun-java6-jdk

Now we can switch Java provider in our system by typing the following in command line

1
sudo update-alternatives --config java

We will be presented with the screen similar to rhis one

1
2
3
4
5
6
7
8
9
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                      Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061     auto mode
   1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061     manual mode
   2            /usr/ lib/jvm/java-6-sun/jre/bin/java        63        manual mode

Press enter to keep the current choice[*], or type selection number: 2

Select the option that has the path /usr/ lib/jvm/java-6-sun/jre/bin/java thats all. Now we check the java version with following command line code.

1
java -version

We should see a similar to the below

1
2
3
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode)

Best Regards.