Unit 2: Setting up your Java development environment

Before you begin

This unit is part of the Intro to Java programming learning path. Although the concepts discussed in the individual units are standalone in nature, the hands-on component builds as you progress through the units, and we recommend that you review the prerequisites, setup, and unit details before proceeding.

Unit objectives

  • Download and install the JDK and the Eclipse IDE
  • Set up your Eclipse development environment
  • Understand the main Eclipse components and how to use them for Java development
  • Create a new Java project in Eclipse

Your development environment

The JDK includes a set of command-line tools for compiling and running your Java code, including a complete copy of the JRE. Although you can use these tools to develop your applications, an IDE gives you additional functionality along with task management and a visual interface.

In this learning path you use Eclipse, a popular open source IDE. Eclipse handles basic tasks, such as code compilation and debugging, so that you can focus on writing and testing code. In addition, you can use Eclipse to organize source code files into projects, compile and test those projects, and store project files in any number of source repositories. You need an installed JDK to use Eclipse for Java development.

Install the JDK

Follow these steps to download and install the JDK:

  1. Browse to Java SE Downloads and click the Java Platform (JDK) box to display the download page for the latest version of the JDK.
  2. Agree to the license terms for the version you want to download.
  3. Choose the download that matches your operating system and chip architecture.


  1. Save the file to your hard drive when prompted.
  2. When the download is complete, run the install program. Install the JDK to your hard drive in an easy-to-remember location such as C:\home\Java\jdk1.8.0_92. (As in this example, it’s a good idea to encode the update number in the name of the install directory that you choose.)


  1. When the download is complete, double-click it to mount it.
  2. Run the install program. You do not get to choose where the JDK is installed. You can run /usr/libexec/java_home -1.8 to see the location of JDK 8 on your Mac. The path that’s displayed is similar to /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home.

See JDK 8 and JRE 8 Installation for more information, including instructions for installing on Solaris or Linux.

You now have a Java environment on your computer. Next, you’ll install the Eclipse IDE and create a Java project in Eclipse

Install Eclipse

Follow along with this video demo to download and install Eclipse on your system, take a quick Eclipse tour, and create a Java project.

Recap: The Eclipse development environment

The Eclipse development environment has four main components:

  • Workspace
  • Projects
  • Perspectives
  • Views

The primary unit of organization in Eclipse is the workspace. A workspace contains all of your projects. A perspective is a way of looking at each project (hence the name), and within a perspective are one or more views.

Figure 1 shows the Java perspective, which is the default perspective for Eclipse. You see this perspective when you start Eclipse.

Figure 1. Eclipse Java perspective
Screenshot of the Eclipse IDE startup screen showing a default Java perspective.

The Java perspective contains the tools that you need to begin writing Java applications. Each tabbed window shown in Figure 1 is a view for the Java perspective. Package Explorer and Outline are two particularly useful views.

The Eclipse environment is highly configurable. Each view is dockable, so you can move it around in the Java perspective and place it where you want it. For now, though, stick with the default perspective and view setup.

You’ve now created a new Eclipse Java project and source folder. Your development environment is ready for action. However, an understanding of the OOP paradigm — covered in the next unit — is essential before you start coding in Java.

Previous: Java platform overviewNext: Object-oriented programming concepts and principles

J Steven Perry