Intro To Eclipse Ganymede
Intro To Eclipse Ganymede
Overview
Eclipse Background
Obtaining and Installing Eclipse
Creating a Workspaces / Projects
Creating Classes
Compiling and Running Code
Debugging Code
Sampling of Features
Summary
What is Eclipse?
Eclipse started as a proprietary IBM product (IBM Visual
age for Smalltalk/Java)
Embracing the open source model IBM opened the product up
Open Source
It is a general purpose open platform that facilitates and
encourages the development of third party plug-ins
Eclipse on GL
This years coordinated release (known as
Ganymede) of the Eclipse IDE for Java
Developers has been installed on GL
From any of the Linux machines in the labs
simply run the command eclipse
Obtaining Eclipse
Eclipse can be downloaded from
http://www.eclipse.org/downloads/packages/
Be sure to grab Eclipse IDE for Java
Developers
Installing Eclipse
Simply unwrap the zip file to some
directory where you want to store the
executables
On windows
I typically unwrap the zip file to C:\eclipse\
I then typically create a shortcut on my
desktop to the eclipse executable
C:\eclipse\eclipse.exe
Under Linux
I typically unwrap to /opt/eclipse/
Launching Eclipse
Once you have the environment setup, go ahead
and launch eclipse
You should see the following splash screen
Selecting a Workspace
In Eclipse, all of your code will live under a workspace
A workspace is nothing more than a location where we
will store our source code and where Eclipse will write
out our preferences
Eclipse allows you to have multiple workspaces each
tailored in its own way
Choose a location where you want to store your files,
then click OK
Welcome to Eclipse
The first time you
launch Eclipse, you
will be presented with
a welcome screen
From here you can
access an overview to
the platform, tutorials,
sample code, etc
Click on the arrow on
the right to get to the
actual IDE
Editor Pane
This is where we edit
our source code
Package Explorer Pane
Outline Pane
Creating a Class
To create a class, simply click on the New
button, then select Class
Package
Class name
Superclass
Whether or not to include a
main
Etc
Fill in necessary
information then click
Finish to continue
Source displayed in a
hierarchical fashion listing
each method name
Packages/Classes
with errors are
marked with a red X
Position in file is
marked with a red
line 1 click allows
you to jump to line
with error
Error underlined with red
squiggly line (just like
spelling errors in many
word processors)
Methods with
errors are marked
with a red X
Running Code
An easy way to run code is to right click on the
class and select Run As Java Application
Run Configuration
Advanced options for executing a program can be found
by right clicking the class then clicking Run As Run
Re-Running Code
After you run the code a first time, you can re-run it just
by selecting it from the run drop down menu
Debugging Code
Eclipse comes with a pretty good built-in debugger
You can set break points in your code by double clicking in the left
hand margin break points are represented by these blue bubbles
Debug Perspective
These buttons allow you
to step through the code
List of breakpoints
Import organization
Context assist
Javadoc assist
Getter/Setter generation
Add unimplemented methods
Exception handling
Reminders
Local history
Import Organization
Eclipse can automatically include import statements for any classes
you are using, just press Control + Shift + o (letter o)
Context Assist
If you are typing and press a . character and pause a second,
Eclipse will show you a list of all available methods for the class
Prevents having to browse javadocs to see what methods are available
Get context assist at any time by pressing Control + Space
Javadoc Assist
Eclipse can also help generate javadoc comments for you, simply
place the cursor before the method and then type /** then Enter
Getter/Setter Generation
Eclipse can automatically generate getters and
setters for member of a class
Exception Handling
Eclipse will also pickup on unhandled exceptions
Tasks
Eclipse allows you to insert reminders into your code and
stores them for you to come back and revisit them
Eclipse recognizes
the following tags
inside comments
TODO
FIXME
XXX
Tasks (continued)
To add a table of all reminders in all of your source code you can
add the Tasks view by clicking on Window Show View Tasks
Tasks (continued)
This neatly displays all tasks in a tabular form
Local History
Summary
Benefits
Code completion
Faster code/compile/
run cycles (real time)
Open source (free)
Extensible (plugins)
Disadvantages
Pretty heavyweight
Requires JRE
Learning Curve