What is Eclipse?

Eclipse is an integrated development environment (IDE). Although Eclipse has grown to be all things to all programmers, we will concentrate on its application as a Java development environment.

Overview

After explaining how to download and unpack and start up Eclipse, we'll explain how to create a LingPipe project directly from it's ant file (with a little help on the classpath). With a project in hand, we can use Eclipse to browse and edit code; the reverse indexing of code for browsing makes it easy to get a feel for a package.

The real strength of Eclipse emerges in its refactoring capabilities. It automatically finds problems and better yet, can automatically fix the simple ones. Eclipse is also useful for stepwise debugging. A good way to get to know someone else's code is to step through it from the main() down to where something interesting happens.

Eclipse Version 3.4

This demo is based on Version 3.4 of Eclipse for 32-bit Windows. Eclipse 3.4 is also available for 32-bit and 64-bit linux, as well as Mac OS X.

Downloading and Unpacking

Eclipse does not need to be installed; just download and unpack it. To download, go to the following URL:

Select the latest release, and click through on its number.

If you are using an OS other than Windows, you'll need to follow the Other downloads link and select the download for the platform you're using.

Once you've downloaded, just decompress the zip file and place it somewhere convenient, which we'll call

The root of the distribution contrains an executable that is run to startup Eclipse.

Running

In Windows, the executable is at the top of the distribution. You can double click it or run it as a command:

$ECLIPSE/eclipse.exe

The first thing the wizard will ask you is to select a workspace for your projects. Select somewhere convenient and let's call it

After this, you will see the main Eclipse SDK window.

Configuring for JDK 1.5

If your Eclipse came preconfigured like ours, you'll need to select from the main menu:

then double click to expand the tree view subitem item:

This will allow you to click the button:

button to select a new JRE.

Next, expand the tree view item:

and then select from the compliance level pulldown:

which allows you to run Java 1.5 (see sidebar).

Then select the button at the bottom of the Compiler panel:

button at the bottom of the Compiler panel. This will pop up a warning dialog telling you the compiler settings changed (I think we knew that -- we just changed them). It then tells you a full rebuild is required and asks you if you want to do it. Select from the popup warning menu the button

We'll build later.

Creating a LingPipe Project

To create a project, select from the main menu:

This pops up the new project wizard, from which you should select from the list of wizards:

from the list of wizards, then click on the button at the bottom of the wizard's window:

Enter the name LingPipe into the text field:

Next, provide a path to the Ant Buildfile directly, or by selecting the button:

which, as the standard UI convention indicates through ellipses (...), will pop up a new dialog box; in this instance, a file browser. Navigate and select:

where $LINGPIPE is the root directory of the LingPipe distribution. Eclipse's wizard will automatically find the javac includeAntRuntime="false" task from ant to build LingPipe.

Fixing the Classpath

Eclipse is not smart enough in importing LingPipe's build.xml file to figure out the two ant targets, compile and compile-test. To help it out, select from the main menu:

which pops up a properties dialog box in a separate window. From the tree viewer control in the left panel, choose:

This pops up the build path panel, from which you need to select the tab:

In the libraries tabbed panel that pops up, click the button

which will pop up a file selector window. Navigate to and double click

to open. Finally, click the button at the bottom of the properties dialog window:

Now the project is all ready to go.

Exploring LingPipe's Code

Returning to the main Eclipse window, you'll see near the top left a tab:

It's panel contains a tree viewer, one root item of which you should double click to expand:

This tree viewer lets you walk the directory structure of LingPipe, viewing both libs and source code trees.

Package Browsing

Double click on the tree viewer to expand the source:

This will display all of the packages in LingPipe. As you will see, many of these are under com.aliasi.test.unit packages, which do not make up part of the standard LingPipe jar

Select a package to expand and double click it:

Now you will see the classes and interface making up the util package. From this view, select and double click the interface:

This provides an expanded view of the com.aliasi.util.Scored interface. It contains two static final constants (both comparators), and two inner static classes (which are private). You will also see a method declaration, which you may double click:

This will open the file $LINGPIPE/src/com/aliasi/util/Scored.java for editing in the editor panel, showing a tab with the name of the file along the top. This is an instance of the reverse indexing from components to the source which is so useful in IDEs. B Scored interface. Clicking on other components of a class or interface have the same behavior; they are hot links to the code.

Type Hierarchy Browsing

Before viewing the hierarchy, you need to create it. You may do this from the package browser view just discussed. In the package explorer, right click on

to pop up a context-sensitive menu and select the menu item:

This switches the view from the Package Explorer to the Hierarchy tab. You'll then see a list of every class in LingPipe.

One of the more useful aspects of Eclipse is the reverse indexing into code it does from the methods, constants, etc. For instance, right clicking on a class or interface in the package explorer tab, such as

will pull up a context-senstivie menu from which if you select:

you will be presented with a list of all of the places in the the code that refer to the Scored interface. These are shown in the search tab of a different panel on the main Eclipse SDK window.

Jar Browsing

The jars included in LingPipe's lib directory are displayed in collapsed form in the package tree viewer. Clicking on the jar will explose the classes contained in the jar. There should not only be the main library for Java, the JRE_LIB, but also the imported LingPipe jars, such as xml-apis-2.9.0.jar.

Building LingPipe

With our already imported ant build file, Eclipse already knows how to build our project. Just select from the main menu Project >> Build All (and start to notice all the keyboard shortcuts while you're at it). This will pop up a progress window, and when that's done, you'll likely get hundreds of warnings until we get around to cleaning up the code so there are no more warnings.