Sunday, March 20, 2011

Installing JDK (Java Development Kit) in Ubuntu 10.04 Lucid

Trying different operating systems for me is quite refreshing, giving me a different perspective on how things are done (like installing from a CLI or command line). But thanks to the web, we can get numerous help with these things. So I'm sharing this post for those who are using Ubuntu (mine is 10.04 aka Lucid) and Java enthusiast. Luckily, the JDK 6 has been dropped from the Multiverse section of the Ubuntu archive. Following these steps will install the latest JDK in your Ubuntu box.
1. Add the Canonical Partner Repository to your apt repositories: $ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
2. Update the source list  of your repository:  $ sudo apt-get update. After doing so, your machine will download and populate your repository with the proper packages.
3. Install the newly added JDK 6: $ sudo apt-get install sun-java6-jdk. This will then check for the dependencies and install Java in your machine. Accept the license and it's done. The JDK package will be installed in /usr/lib/jvm/java-6-sun-1.6.0.2o4. This will also create a symbolic link that we can use to set our default JDK (java-6-sun).
4. Now select the newly installed JDK as the default Java to use instead of the default openJDK: $ sudo update-java-alternatives -s java-6-sun. After doing so, check if JDK is correctly set up: $ java -version. It should return the newly installed JDK, like in the screenshot below.

And you're done! I hope this post helps my fellow Linux newbies. :)

0 comments:

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More