Using Eclipse Effectively
Handout by Lekan Wang
Eclipse is an immensely powerful IDE for Java development, but it can be daunting for novice users.
If you took CS106A at Stanford and/or read Handout #3: Eclipse Starter, then you should already be
familiar with its basic functionality—autocompletion after a dot, organizing your files, on-the-fly
compilation with suggestions for warning and errors, a great debugger, etc—all of which simplify
your coding life. This handout assumes that you are familiar with these most basic features.
But, they say that watching a power-user of Eclipse navigate the IDE is like watching Neo from the
matrix making code bend to his will from sheer mental will and badassitude.
This guide will not attempt to teach you how to dodge bullets in the Matrix, but will quickly
introduce you to some techniques and tips that power-users of Eclipse are generally familiar with. All
shortcuts will be
, and will generally include a short example of when it could come in handy
if not immediately obvious.
Alls shortcuts described here will be PC shortcuts. However, on Macs, generally just replace Ctrl with
(Cmd) key and Ctrl-Shift with Cmd-Option.
Views can be selected by going to Window->Show View.
Useful Views for the Java Perspective
The editor view will obviously be your most used view. What’s useful sometimes is to drag an editor
view to the lower half of your editor view so you have a split editor. This way, you can refer to some
code while editing another piece of code. If you maximize the editor view by double-clicking the tab,
or by using the shortcut
, all editor views will maximize, keeping the split view.
On the left sidebar generally is your Package Explorer. If you prefer a less Java-centric view, and
instead want a view closer to a folder browser like Windows Explorer or the Mac Finder, then the
Navigator view is for you. In both of these views is a “Link with Editor” button, signified by a dual
left-right arrow. If this is checked, the Package Explorer or Navigator will automatically keep
selected whatever file you are currently editing in the editor window. If you prefer to keep this
unchecked, clicking this button is a quick way to “locate” the currently edited file in your
Often also on the left side is the Hierarchy view, which displays a selected class’s type hierarchy. To
use this view, position your cursor over any declaration or reference to an object. You can then press
to show that class in the type hierarchy. Similarly, if your cursor is over a method name or
instance/class variable, pressing
will show the current class in the type hierarchy, and also