Eclipse at VTC


This note briefly describes how to use the Eclipse integrated development environment to do Java programming. This note does not attempt to cover every aspect of using Eclipse. Instead it focuses on helping you get up and running quickly with the system in a very generic way. I want you to be able to concentrate more on your Java programming without being distracted by the development environment.

Eclipse is an open source system that can be freely downloaded and used by anyone. It is a framework for creating integrated development environments (IDEs). By writing suitable plug-ins you can create an IDE using Eclipse for almost any development task. In this note I will focus on Eclipse's default support for Java programming.


First be sure you have a recent Java Development kit installed. You can download the latest JDK from Oracle. Be sure to get the JDK (the development kit) and not just the JRE (runtime environment). The JDK contains the JRE. Run the JDK installer. You can accept all defaults.

Download the latest version of Eclipse from The version I describe here is Juno (v4.2) but you may find a newer version on the Eclipse web site. As a convenience Eclipse also comes with various collections of plug-ins prepackaged. For our purposes you can just use the "standard" package. In fact you can install whatever plug-ins you need later so it is not necessary to download a package, for example, specific to Java programming.

After downloading the Eclipse archive, unpack it to some suitable location and make a shortcut to the eclipse.exe file in the root folder of the distribution. Launch Eclipse by double clicking on that shortcut.

General Organization of Eclipse

It is useful to keep in mind that Eclipse is a generic IDE framework. Thus some of the concepts and metaphors that it employs are not specific to any particular type of development. Even if you only use Eclipse for Java programming it helps to think about its support for Java as one of perhaps many different possibilities.

The Eclipse workbench is organized as a collection of "views." Each view is a single window with a particular function. For example there is an editor view that allows you to edit your source code. There is also a navigator view, a task view, and a bookmark view, to name a few.

The views can be opened and closed individually. However, Eclipse also defines a collection of related views as a "perspective." The Java perspective, for example, shows you views of interest to Java programming. The debugging perspective shows you views for debugging. Eclipse lets you switch from one perspective to another at any time. Switching perspectives does not actually change what you are doing, only what you see. Since you can open any view you like while in any perspective, the perspectives are not rigidly defined. In fact, you can create your own perspectives by simply opening the views you find useful and then saving the configuration as a perspective using the "Window... Save Perspective As..." menu option.

Like all IDEs, Eclipse lets you organize your work into projects. However, unlike many IDEs Eclipse can have all projects open all the time. Although it is possible to close a project, you often don't need to bother with that. Instead you just navigate from project to project using the Navigator view. By default all files for all projects are stored in the Eclipse workspace folder. However you can direct Eclipse to use a different folder for different projects.

There are a number of tutorial files under Eclipse's Help menu. I recommend working through the Basic Tutorial under the Workbench User Guide's "Getting Started" chapter. Select "Help... Help Contents..." from the menus and then drill down into the Workbench User Guide. Eclipse has many powerful features that are not immediately obvious. Working through the tutorials will help you become a more effective Eclipse user.

Creating a Java Project

The following steps describe how to create a Java project from scratch.

  1. Right click in the Navigator view (switch to the Resource Perspective if you don't see the Navigator view). Select "New... Project..." from the pop-up menu that appears.

    New project

  2. In the "New Project" dialog select "Java Project." Stock Eclipse only supports a handful of project types. However, "Java" should be one of the possible selections. Depending on the plug-ins you have installed you may see many other project types. Click "Next".

          Java project

  3. Enter "Hello" for the project name in the dialog box that appears. Notice that Eclipse creates a folder with the same name beneath the workspace folder. You can review the other settings but the defaults should be fine. Click "Finish" (you can use "Next" to adjust some advanced options).

    Open perspective

  4. Eclipse will create the project and then ask you if you want to switch to the Java perspective. Say "yes".

  5. Right click on the name of the project in the Package Explorer view (probably on the left side of the screen) and then select "New... Class..." from the pop-up menu. Fill in the name for your class in the dialog box that appears. I suggest that you use the name of your project for the name of your main class. The other defaults are probably fine.

    New Java class

    You may notice the message "The use of the default package is discouraged" at the top of the window. Normally you would put all of your classes into one package or another but for a very simple program that might be unnecessary.

  6. Eclipse will generate a skeleton file for the class. Fill in the code to make a simple "Hello, World" application. Notice that Eclipse will show you problems with your program as you type it. Eclipse will also offer suggestions about what to type next in places where it can reasonably give you such help. This feature is generally called "code completion."

    Eclipse workbench

When you want to execute your project you will find a button to run it on the tool bar just below the Workbench's main menu (it's the green arrow). The output of your program will be captured by the console view (probably near the bottom of the screen).

Have fun programming with Eclipse!

© Copyright 2013 by Peter C. Chapin.
Last Revised: August 4, 2013