Eclipse Tutorial
Eclipse Tutorial
This tutorial will teach you how to use Eclipse in your day-2-day life while developing any
software project using Eclipse IDE. We will give special emphasis on Java project.
Audience
This tutorial has been prepared for beginners to help them understand basic functionality
of Eclipse tool. After completing this tutorial, you will find yourself at a moderate level of
expertise in using Eclipse IDE from where you can take yourself to next levels.
Prerequisites
We assume you are going to use Eclipse IDE to handle all levels of Java projects
development. So it will be good if you have knowledge of software development using any
programming language specially Java programming.
All the content and graphics published in this e-book are the property of Tutorials Point (I)
Pvt. Ltd. The user of this e-book can retain a copy for future reference but commercial use
of this data is not allowed. Distribution or republishing any content or a part of the content
of this e-book in any manner is also not allowed without written consent of the publisher.
We strive to update the contents of our website and tutorials as timely and as precisely as
possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.
Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our
website or its contents including this tutorial. If you discover any errors on our website or
in this tutorial, please notify us at [email protected]
i
Eclipse
Table of Contents
About the Tutorial .................................................................................................................................... i
Audience .................................................................................................................................................. i
Prerequisites ............................................................................................................................................ i
1. OVERVIEW........................................................................................................................... 1
Licensing ................................................................................................................................................. 1
2. INSTALLATION ..................................................................................................................... 3
Moving Views.......................................................................................................................................... 9
ii
Eclipse
6. PERSPECTIVES ................................................................................................................... 13
7. WORKSPACES .................................................................................................................... 16
iii
Eclipse
iv
Eclipse
27. NAVIGATION...................................................................................................................... 58
v
Eclipse
vi
1. OVERVIEW Eclipse
What is Eclipse?
In the context of computing, Eclipse is an integrated development environment (IDE) for
developing applications using the Java programming language and other programming
languages such as C/C++, Python, PERL, Ruby etc.
The Eclipse platform which provides the foundation for the Eclipse IDE is composed of plug-
ins and is designed to be extensible using additional plug-ins. Developed using Java, the
Eclipse platform can be used to develop rich client applications, integrated development
environments, and other tools. Eclipse can be used as an IDE for any programming language
for which a plug-in is available.
The Java Development Tools (JDT) project provides a plug-in that allows Eclipse to be used
as a Java IDE, PyDev is a plugin that allows Eclipse to be used as a Python IDE, C/C++
Development Tools (CDT) is a plug-in that allows Eclipse to be used for developing application
using C/C++, the Eclipse Scala plug-in allows Eclipse to be used an IDE to develop Scala
applications and PHPeclipse is a plug-in to eclipse that provides complete development tool
for PHP.
Licensing
Eclipse platform and other plug-ins from the Eclipse foundation is released under the Eclipse
Public License (EPL). EPL ensures that Eclipse is free to download and install. It also allows
Eclipse to be modified and distributed.
Eclipse Releases
Every year, since 2006, the Eclipse foundation releases the Eclipse Platform and a number of
other plug-ins in June.
7
Eclipse
8
2. INSTALLATION Eclipse
Downloading Eclipse
You can download eclipse from http://www.eclipse.org/downloads/. The download page lists
a number of flavors of eclipse.
The capabilities of each packaging of eclipse are different. Java developers typically use
Eclipse Classic or Eclipse IDE for developing Java applications.
The drop down box in the right corner of the download page allows you to set the operating
system on which eclipse is to be installed. You can choose between Windows, Linux and Mac.
Eclipse is packaged as a zip file.
Installing Eclipse
To install on windows, you need a tool that can extract the contents of a zip file. For example
you can use:
7-zip
PeaZip
IZArc
Using any one of these tools, extract the contents of the eclipse zip file to any folder of your
choice.
9
Eclipse
Launching Eclipse
On the windows platform, if you extracted the contents of the zip file to c:\, then you can
start eclipse by using c:\eclipse\eclipse.exe
When eclipse starts up for the first time it prompts you for the location of the workspace
folder. All your data will be stored in the workspace folder. You can accept the default or
choose a new location.
10
Eclipse
If you select "Use this as the default and do not ask again", this dialog box will not come up
again. You can change this preference using the Workspaces Preference Page. See the
Preference tutorial page for more details.
11
3. EXPLORE WINDOWS Eclipse
Views
Menu Bar
Toolbar
An eclipse perspective is the name given to an initial collection and arrangement of views and
an editor area. The default perspective is called java. An eclipse window can have multiple
perspectives open in it but only one perspective can be active at any point of time. A user can
switch between open perspectives or open a new perspective. A perspective controls what
appears in some menus and tool bars.
12
Eclipse
A perspective has only one editor area in which multiple editors can be open. The editor area
is usually surrounded by multiple views. In general, editors are used to edit the project data
and views are used to view the project metadata. For example, the package explorer shows
the java files in the project and the java editor is used to edit a java file.
The eclipse window can contain multiple editors and views but only one of them is active at
any given point of time. The title bar of the active editor or view looks different from all the
others.
The UI elements on the menu bar and tool bar represent commands that can be triggered by
an end user.
Each window can have a different perspective open in them. For example you could open two
Eclipse windows one in the Java perspective and the other in the Debug perspective. The
window showing the Java perspective can be used for editing the java code and the window
showing the debug perspective can be used for debugging the application being developed.
13
4. EXPLORE MENUS Eclipse
File menu
Edit menu
Navigate menu
Search menu
Project menu
Run menu
Window menu
Help menu
14
Eclipse
Plug-ins can add new menus and menu items. For example when the java editor is open, you
will see the Source menu and when the XML editor is open, you will see the Design menu.
File The File menu allows you to open files for editing, close editors, save editor
content and rename files. Among the other things, it also allows you to
import and export workspace content and shutdown Eclipse.
Edit The Edit menu presents items like copy & paste.
Source The Source menu is visible only when a java editor is open. It presents a
number of useful menu items related to editing java source code.
Navigate The Navigate menu allows you to quickly locate resources and navigate to
them.
Search The Search menu presents items that allow you to search the workspace
for files that contain specific data.
Project The menu items related to building a project can be found on the Project
menu.
Run The menu items on the Run menu allow you to start a program in the run
mode or debug mode. It also presents menu items that allow you to debug
the code.
Window The Window menu allows you to open and close views and perspectives. It
also allows you to bring up the Preferences dialog.
Help The Help menu can be used to bring up the Help window, Eclipse
Marketplace view or Install new plug-ins. The about Eclipse menu item gives
you version information.
15
Eclipse
Customizing Menus
The visible menu items on a menu depend on the installed plug-ins and customization done
using the Customize Perspective dialog box.
16
5. EXPLORE VIEWS Eclipse
About Views
Eclipse views allow users to see a graphical representation of project metadata. For example
the project navigator view presents a graphical representation of the folders and files
associated with a project and properties view presents a graphical representation of an
element selected in another view or editor.
An eclipse perspective can show any number of views and editors. All editor instances appear
in a single editor area, whereas views are placed inside view folders. A workbench window
can display any number of view folders. Each view folder can display one or more views.
Organizing Views
The following picture shows four views arranged in a view folder.
The picture given below shows the same four views arranged in two view folders.
17
Eclipse
Moving Views
To move a view from one view folder to another, just click on the view title and drag to the
title bar area of another view folder. The green line shown below is a result of dragging the
title bar of the Properties view from one view folder to the title bar area of another view folder.
The Properties view can be moved to where the green line is by releasing the mouse button
and sending out a drop event.
Moving the drag icon to the bottom of a window allows you to create a view folder that spans
the entire width of the window. Moving the drag icon to the left or right edge of window allows
you to create a view folder that spans the entire height of the window.
18
Eclipse
Opening a view
To open a view, click on the Window menu and select the Show View menu item.
19
Eclipse
Clicking on the Other menu item brings up the Show View dialog box that allows you to locate
and activate a view.
20
Eclipse
The views are organized by category. To quickly locate a view, just type the name of a view
into the filter text box. To open a view, select it and click on the OK button. The subsequent
pages of this tutorial introduce you to a number of useful views.
21
Eclipse
22