Quick Tutorial on the Eclipse IDE Framework (including all the "wizard" stuff no one seems to tell you on the Web)

Professor Norm Matloff
University of California, Davis

Contents:

About Eclipse:

Personally, I am NOT a fan of Integrated Development Environments (IDEs). They take up too much space on the screen; they tend to be slow to load; and worst of all, most of them force me to use their text editor, rather than the one I use for everything, Vim. That latter point is important to me; over the years I've built up a number of shortcuts in my Vim startup file which save me typing, and I use Vim for everything I do--programming, word proceessing, Web development, e-mail and so on. (But see the comment on the Vim plugin for Eclipse below.)

Having said that, though, if I were to use any IDE, Eclipse would be the one.

Eclipse is a framework for IDEs. I say "framework," because it provides the infrastructure for the IDE, and then the IDE is completed by using a plugin for a particular programming language. Plug-ins exist for Java (which was its first application), C/C++, Python, Perl and many others.

Moreover, I actually can still use Vim, as an Eclipse plugin exists for it, called vimplugin.

Eclipse is multi-platform, runnable on Linux, Windows (Cygwin or MinGW needed in the C/C++ case), etc.

Eclipse came out of the Websphere project at IBM. (See IBM interview.) Though the Eclipse project is now fully open-source, it is still strongly supported by IBM. It has been pointed out that basically Eclipse is a $40 million gift to the open-source world.

Quick Start:

For a quick introduction to Eclipse, do the following:

Eclipse is Finicky:

Eclipse is a very nice piece of software, enjoyable to use once you get the hang of it. However, beginners beware--Eclipse can be pretty unforgiving if you don't issue commands in the desired sequence. Just be patient with this, and you will be rewarded.

How to Obtain and Install Eclipse:

You need to have Java installed, which you almost certainly do already. However, if you only have GNU Java, you should consider downloading Sun Java, as Eclipse will run much faster with it. To obtain Sun Java in Ubuntu Linux, type

sudo apt-get install sun-java6-jdk

You can use apt-get in Ubuntu or yum in Fedora Linux to get Eclipse too, but you are likely to get an older version this way. The tutorial here assumes at least Eclipse 3.3, which differs from earlier versions. So, I recommend manual download and install:

You can download the package from Eclipse's home page. Then do the following:

Eclipse Perspectives and Views:

The main kinds of components in Eclipse are:

Perspectives:

A perspective is the environment under which your Eclipse screen is currently operating. Roughly speaking, there is a different perspective for each language, i.e. a C/C++ perspective, a Java perspective, a Python perspective and so on. There is also a debug perspective, or more precisely speaking, one for each language perspective.

The perspectives are plugin packages, which you typically download separately from Eclipse.

You can go to a new perspective by selecting Window | Open Perspective and making your choice, or more rapidly, by choosing it from the right end of the Eclipse top toolbar if it appears there, or by clicking the Open a Perspective icon in that same location.

Views:

A perspective consists of a number of tabbed subwindows, called views.

For example, for C/C++ code, you would be in the C/C++ perspective, while editing and running your code. You'd have a navigator view listing your various C/C++ projects (more on this below), an editor view for each file you currently are editing, an Outline view showing each of the major components of your code (functions, global variables, etc.), a Console view in which standard input/output would be done, and so on. During your work on your C/C++ code, you would occasionally use the debugger, in which case you would temporarily switch to the Debug perspective, which would have a number of views as well.

Most language perspectives include a navigator view, listing projects. For C/C++, it is called C/C++, for Python it is the Pydev Package Explorer, in Java it's simply the Package Explorer and so on. Or you can always go to the generic navigator view, called Navigator.

The view of a view, no pun intended, is often cramped. To enlarge it, you can drag its border horizontally or vertically. Or click on the Maximize icon; it becomes a Restore icon which you can use to return to the default (cramped) mode.

If a view is no longer on your screen, you can retrieve it by selecting Window | Show View and then clicking on the view name.

If within a perspective you wish to reset the views to their original configurations, select Window | Reset Perspective.

General Procedures:

Following are the steps for creating, developing and debugging a project. Note that in some cases there are special details for your particular language, which you must check in the "Special Details" section below for that language.

Special Issues in Working in C/C++:

Special Issues in Working in Python:

Special Issues in Working in Perl:

Special Issues in Working in Java:

Projects:

As with many IDEs, Eclipse organizes things into projects. A project is a directory within your workspace, which if you took the default when you installed Eclipse is the workspace directory within your Eclipse directory, e.g. /usr/share/eclipse/workspace or $HOME/workspace.

To create a new project:

To go to a project, either previously existing or one you just created: You can double-click the project name in the navigator view. If you don't see the panel, switch to the perspective for your language.

Editing Files:

If you wish to create a new file that is a copy of one outside your current project, import it, using the Import command described below. To create a new file using Eclipse's editor, or to edit an existing one, read the following.

Eclipse attempts to find an editor related to your file type (.c, .py etc.), possibly part of the plugin for the language you're working in. It use syntax highlighting and perform other actions tailored to your file type.

To make a new file:

To edit an existing file:

To save your edited file, either right-click the file display and select Save, or use the keyboard shortcut ctrl-s.

Noteworthy editing operations:

Importing Files:

You can importing files from another directory into your current project, as follows:

Debugging:

Keep in mind that the behavior of the Debug perspective will vary from one language to another. But here are the features in common:

Outlines:

Make good use of these! While you are editing, the Outline view will show you where your major code objects are, i.e. functions, classes, etc. Clicking on one will make the editor jump to that spot in the code.

The same is true for debugging. If you need to set a breakpoint at some function, for instance, click on its name in the outline, which will bring you right there, so you can set the breakpoint.

Error Messages:

Resetting:

You may find the following reset mechanisms helpful:

Obtaining and Installing Eclipse Plugins:

We'll illustrate the process for the C/C++ plugin, CDT. If you don't already have CDT (you can check by selecting Window | Show View, possibly clicking on Other), do the following:

You can install a plugin "by hand," or by using Eclipse's built-in plugin download/installation feature. Let's look at the latter first.

Automated Installation of a Plugin:

"By-Hand" Installation of a Plugin:

A plugin comes as .zip files, which packages the various .jar and other files of the plugin. Unzip the plugin, and copy the contents of the features and plugins directories get copied to Eclipse's corresponding directories. For example, say your Eclipse plugins directory is /usr/local/eclipse/plugins and you have unzipped your plugin package in /tmp. Then within /tmp, run

$ cp -r features plugins /usr/local/eclipse

(This is for Linux; adjust accordingly for Windows.)

After a manual installation, restart Eclipse with the -clean command-line option.

Checking Whether a Plugin Is Installed:

Select Help | About Eclipse Platform | Plug-in Details.

Disabling or Uninstalling a Plugin:

Select Help | Software and Updates | Manage Configuration.

Installing a Plugin in a Nonstandard Directory:

You may wish to put some plugins in a different directory from the one set up when Eclipse was installed. For instance, you may be using a multiuser machine and not have write access to the standard plugins directory. In that case, you can form your own supplementary plugins directory. See Colin's blog for directions on how to do this.

For More Information: