O'Reilly logo

Eclipse IDE Pocket Guide by Ed Burnette

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 1. Introduction

Welcome to the pocket guide for the Eclipse Integrated Development Environment. This book is the ultimate “no fluff” user’s manual for the Eclipse IDE, in particular, its Java Development Toolkit (JDT). This book is designed to get you up and running quickly in the environment even if you’ve never used Eclipse before. Some Java™ programming knowledge will be helpful when reading this guide, but even if you’re new to Java, you can still find a good deal of useful information within these pages. Let’s begin with an overview of what Eclipse is and how to download and install it. If you’re already using Eclipse, you can skip this section and jump to Part II.

What Is Eclipse?

Eclipse is an IDE for “anything, and nothing at all,” meaning that it can be used to develop software in any language, not just Java. It started as a proprietary replacement for Visual Age for Java from IBM, but was open sourced in November 2001. Eclipse is now controlled by an independent nonprofit organization called the Eclipse Foundation. Since 2001, it has been downloaded over 50 million times; it is now being used by thousands of developers worldwide. It also has a sizable following in the university community, where it is used in classes on programming and object-oriented design.

Conventions Used in This Book

Italic

Used for filenames, directory names, URLs, and tools from Unix such as vi. Also used for emphasis and to introduce new terms.

Constant width

Used for names of Java packages, methods, etc.; commands; variables; and code excerpts.

Constant width bold

Used for keywords within code examples and for text that the user should type literally.

System Requirements

Eclipse runs on today’s most popular operating systems, including Windows XP, Linux, and Mac OS X. It requires Java to run, so if you don’t already have Java installed on your machine, you must first install a recent version. You can download Java for Windows and Linux from http://java.sun.com; look for the J2SE SDK (Software Development Kit) package without a NetBeans™ bundle. Mac OS X has Java preinstalled. See Table 1 for the minimum and recommended system requirements.

Table 1-1. System requirements for Eclipse

Requirement

Minimum

Recommended

Java version

1.4.0

5.0 or greater

Memory

512 MB

1 GB or more

Free disk space

300 MB

1 GB or more

Processor speed

800 Mhz

1.5 Ghz or faster

In order to unpack Eclipse’s download package, you will need a standard archive program. Some versions of Windows have one built in; for other versions, you can use a program such as WinZip (http://www.winzip.com). The other platforms come with an archive program preinstalled.

Tip

In the interests of space and simplicity, the rest of this book will focus on the Windows version of Eclipse. Other platforms will be very similar, although you may notice slight platform-specific differences.

Downloading Eclipse

To download the Eclipse IDE, go to http://www.eclipse.org. Click on “downloads” and then select the most recent stable or release version of the Eclipse SDK for your platform. If prompted for a mirror site, pick the one located closest to you. If that one is slow or unavailable, simply return to the download page and try a different mirror, or try the main site.

Tip

You may see other download packages such as Runtime, JDT, and RCP on the download page. You don’t need those. Just get the one package called Eclipse SDK.

Installing Eclipse

First, install Java if you haven’t already. Then download the Eclipse SDK to a temporary directory. Use your archive program to unpack Eclipse into a permanent directory. There are no setup programs and no registry values to deal with.

After you have unpacked the SDK, you should have a subdirectory called eclipse, which in turn has directories in it such as plugins and features. If you don’t see these, check the settings on your archive program. A common mistake is to unpack Eclipse in such a way that its directory structure is not preserved. Eclipse won’t run unless you unpack it with the exact directory paths that exist in the archive.

3, 2, 1, Launch!

You are now ready to launch Eclipse. Inside the eclipse directory, you’ll find a launcher program for the IDE called, strangely enough, eclipse (or eclipse.exe). Invoke that program to bring up the IDE.

Tip

On Windows, you may find it convenient to create a desktop shortcut to launch Eclipse.

Specify a Workspace

The first time you start Eclipse, you will be prompted for the location of your workspace. The workspace is the location where your source code and other files and settings will be stored on your workstation. Specify a permanent location—somewhere not in your install directory—preferably a location that will be backed up regularly.

Putting the workspace in a different place from where you installed Eclipse makes upgrades easier. See the “Getting Upgrades” section, later in Part I, for more information.

Exploring Eclipse

When Eclipse starts up, you will be greeted with the Welcome screen (see Figure 1). This screen provides an introduction for new users who don’t have the benefit of a pocket guide to Eclipse; for now you can skip over it by closing the Welcome view (click on the close icon—the x next to the word “Welcome”). You can always come back to the Welcome screen later by selecting Welcome from the Help menu.

The Welcome screen allows you to explore introductory material, including examples and tutorials.
Figure 1-1. The Welcome screen allows you to explore introductory material, including examples and tutorials.

Getting Upgrades

Eclipse includes an automatic update facility that can handle point releases (i.e., bug-fix versions) without any work on your part. For example, Eclipse would install an upgrade from 3.1.0 to 3.1.1 automatically. However, for anything more substantial, the best practice is to do a manual clean install.

Tip

A clean install is especially important if you want to use beta versions of Eclipse (called Stable or Milestone builds on the download page). Milestone builds are sometimes buggy, so you may need to temporarily go back and run your previous version.

For example, let’s say you have been running Version 3.1 for a while and now Version 3.2 has come out. You want to upgrade right away because each new release contains a number of important bug fixes and useful new features. Also, if you have a problem with an older release and report it to the developers, they will simply ask you to upgrade (see “Reporting Bugs” in Part IX). So, you should upgrade, but what’s the best way to do it?

First, rename your eclipse directory to something else, like eclipse3.1. Then download the new SDK package and install it normally, as if you had never installed Eclipse before. This is called a clean install because you are not attempting to mix new and old code together. Note that your workspace doesn’t need to change at all, but you should back it up before running the new version just in case. Now do you see why I recommended you don’t keep your workspace in the install directory?

Tip

Any additional plug-ins you have installed for Eclipse will need to be reinstalled at this point unless you keep them in an extension location separate from the Eclipse SDK.

Moving On

Congratulations—you’ve successfully downloaded, installed, and started exploring Eclipse. In Part II, you’ll learn what all the windows and buttons are for and how to set up the environment just the way you like it. If you want to skip ahead and start writing a Java program, jump to Part III.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required