Install Sun's JDK 6 on Ubuntu Jaunty (9.04)


In the following article I’m going to log a few steps to setup the latest Java SDK and Eclipse IDE on Ubuntu. It is the first in a series of posts I plan to write as I migrate my development environment from Windows to Ubuntu. Other frameworks, SDKs, APIs, tools, database or application servers will be covered separate posts later.

Ubuntu’s latest distribution ships with a very old version of Eclipse (3.2.2) still. On my old system I sometimes dealt with different SDK versions simultaneously, so I didn’t want to rely on the package manager alone, too. I started by downloading the latest Java SDK from http://java.sun.com. I downloaded jdk-6u14-linux-i586.bin and saved the file in /usr/local/, made it executable and ran the file

chmod +x jdk-6u14-linux-i586.bin
./jdk-6u14-linux-i586.bin

I extracted all files to /usr/local/jdk1.6.0_14. Next I added an environment variable JAVA_HOME and added the bin-path to the PATH variable.

$ gedit /etc/bash.bashrc

And add:

# Java SDK
export JAVA_HOME=/usr/local/jdk1.6.0_14
export PATH=$JAVA_HOME/bin:$PATH

The command java -version should now display

java version “1.6.0_14″
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
Eclipse

Eclipse could be installed as easily as the Java SDK. I downloaded the Eclipse IDE for Java Developers from Eclipse.org, extracted the archive to /usr/local, and added it to the PATH variable as well.

$ gedit tar -xvf eclipse-java-galileo-linux-gtk.tar.gz
$ gedit /etc/bash.bashrc

# Eclipse
export PATH=/usr/local/eclipse:$PATH

Finally, the Java SDK has to be added to Eclipse’s Preferences in Window|Preferences|Java|Installed JREs|Add. The dialog is pretty self-explanatory.

That’s it for now. I might add additional steps to configure and fine-tune this development environment later.

Happy Testing...!!


Sources : http://blog.wessendorf.org/

1 comment:

  1. why /usr/local? I'm a linux newb, is it really all your own preference where to put it? There's no "Program Files" in linux?

    ReplyDelete

Please Comment...!!