Sunday, March 29, 2009

Setup Java development environment in Ubuntu/Kubuntu Interpid

Using apt-get it is easy to setup eclipse based development environment for java. Ubuntu by default installs the GNU compiler of Java (GCJ) for java runtime environment. The instructions for installing Sun java JDK are explained in Installing Sun JDK 6 in Ubuntu/Kubuntu Interpid. Installing eclipse is straight forward.

1. Open terminal window
2. Type
sudo apt-get install eclipse

Source code control:
CVS is installed with eclipse as default source code management. Following link can be used to install SubVersion (SVN):

http://subclipse.tigris.org/install.html

Installing Java Enterprise Edition

1. Download Java EE 5 from the sun java ee site.
2. Make the downloaded file executable
chmod +x java_ee_sdk-5_07-linux-nojdk.bin
3. Execute the file
./java_ee_sdk-5_07-linux-nojdk.bin
4. Install any other dependencies that might require using
sudo apt-get install

Installing Sun JDK 6 in Ubuntu/Kubuntu Interpid

1. Open terminal
2. Type
sudo apt-get install sun-java6-jdk sun-java6-plugin
The installation downloads around 52 MB. A Operating System Distribution License (DLJ) agreement appear, read it till the end, press Tab and click OK buttion.

Usually, GCJ is installed in the system by default. So an alternative must be set for the Sun java, so that the java applications use the newly installed version during startup.

3. Type
sudo update-java-alternatives -s java-6-sun

4. Type
java --version
It will check which version is currently set as default.

Alternative to steps 3 & 4 the following step can be used:

5. Type
sudo update-alternatives --config java

and then select the number for sun java-6.

A detailed description can be found in kubuntu community docummentaion for java.