Wednesday, November 17, 2010

How to Setup Your Java Development Environment in Ubuntu

In this post, I’m going to explain how you can setup a Java development environment (JDK + Eclipse) in Ubuntu. I’m using Ubuntu 10.10, but these steps should be applicable to majority of Ubuntu versions.
Let’s start with JDK first.
Install Sun JDK:

  • Download the Linux version of latest JDK binary from the Oracle website. For Java 6, the file name would be: jdk-6u22-linux-i586.bin
  • Copy the downloaded JDK file to a directory where you want to install the JDK. I use /home/<username>/java/jdk-6u22-linux-i586.bin
  • Open terminal window and navigate to the directory where you copied the downloaded file. Then type the command: sudo sh jdk-6u22-linux-i586.bin and press enter.
  • If it asks for root password, give it and JDK installation will begin. The JDK will be installed on the same directory where the binary is placed.

That’s it. JDK installation is done. But we still have one more step to complete. That is, setting up the JAVA_HOME environment variable.
Setting up JAVA_HOME environment variable:

  • Go to Nautilus file browser (Places -> Home Folder) and open this file: “.bashrc”. By default this file is hidden. So, press Ctrl + H which will show all hidden files and then you can see the .bashrc file.

Read more: Javalobby