Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Setup Your Java Development Environment in Ubuntu

DZone's Guide to

How to Setup Your Java Development Environment in Ubuntu

· Java Zone
Free Resource

What every Java engineer should know about microservices: Reactive Microservices Architecture.  Brought to you in partnership with Lightbend.

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:

  1. 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
  2. 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
  3. 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.
  4. 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:

  1. 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.
  2. Add the below code snippet at the end of the .bashrc file:
    export JAVA_HOME='/home/<username>/java/jdk1.6.0_22'
    PATH=.:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

    Don’t forget to change the path in first line according to where you installed your JDK

  3. That’s it. Log off and Log in again for the changes to take effect. To test whether the installation successful, open Terminal and type java -version which should show you the currently installed JDK version.

Install Eclipse:

Installing Eclipse in Ubuntu is pretty simple. Just download the ZIP file from Eclipse.org and then unzip it. The installation is done. ;-)

From http://veerasundar.com/blog/2010/11/how-to-setup-java-development-environment-in-ubuntu/

Microservices for Java, explained. Revitalize your legacy systems (and your career) with Reactive Microservices Architecture, a free O'Reilly book. Brought to you in partnership with Lightbend.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}