6.031 — Software Construction
Fall 2017

Eclipse FAQ

Please post on Piazza to suggest further Eclipse tips and tricks we might include.


Java Debugging with Eclipse introduces Eclipse’s debug mode, a recommended tool for tracking down bugs using breakpoints. This step-by-step tutorial explains the Debug perspective and provides screenshots to decode the mysterious debugger icons in Eclipse.


I messed up my Eclipse and it doesn’t show all the things it used to show

Open Perspective, Java, Debug

First, make sure you are in the Java perspective: in the top right corner of the window, click the Open Perspective toolbar button and select Java.

If your Java perspective doesn’t look right, go to WindowReset Perspective to return to the Eclipse defaults.

Tips & Tricks

Open Declaration and Open Implementation

Command-click (on Mac) or control-click to jump straight to the definition of a variable, field, method, class, etc.

Return to the previous file you were working on with Navigate → Back, which might have keyboard shortcut Alt–left-arrow or Command - [. Eclipse’s Navigate Back and Forward are analogous to the back and forward buttons in your web browser.

Command- (or control-) -shift-R and command-shift-T bring up a dialog for quickly searching for and navigating to files (a.k.a. resources) and types (classes), respectively.


Enter new name, press return to refactor

Select an element and use Refactor → Rename (or its keyboard shortcut) to rename that variable, field, method, class, etc. wherever it appears.

Take advantage of code completion to help you use a new API: if you have an object squiggle, typing the name and then a period will bring up code completion options.

Use Source → Organize Imports or Command- (or Control-) -Shift-O to automatically add and organize Java import statements. Just start using a new class, Organize Imports, and you’re good to go.

Don’t like formatting and indenting your code manually? Use Source → Format to clean up your act.

After you complete Configure Eclipse, Source → Format will change any tabs you have lying around into spaces. You can right-click the package to de-tab all of your classes at once.

Use Source → Toggle Comment or keyboard shortcut Command - / to quickly toggle on or off some lines of code.

Use block selection to edit across multiple lines at once.

Have fun in 6.031!