Contents:
Eclipse is a multi-platform integrated development environment with strong support for Java. In addition to various features that facilitate the writing of Java code (such as autocompletion and code refactoring), it has built-in support for JUnit, and Ant — tools that we use in CSE331.
Eclipse (version 3.5) is already installed in UW CSE instructional lab. See here for how to use Eclipse at home.
You can read more about and get help on the features of Eclipse in its online documentation.
Related pages:
Here are some tips for things that can make your life easier in Eclipse:
Autocomplete | Ctrl-Space asks Eclipse to help
you complete some code you've started. Eclipse can complete lots
of things:
|
Organize import statements | Ctrl-Shift-O (that's O as in Organize) automatically updates the import statements at the top of your class, adding classes that need to be imported from other packages and removing classes that you're no longer using. If a class name is ambiguous — e.g., List might be either java.util.List and java.awt.List — then Eclipse pops up a dialog asking you which one you want. |
Look up Java API documentation | Shift-F2 when your cursor is on a class or method name (You have to configure this feature with the location of the API documentation). |
Comment/uncomment a block of code | Ctrl-/ comments the highlighted region. Ctrl-\ uncomments the highlighted region. |
Renaming or moving packages, classes, methods, and variables (updates all references) | Alt-Shift-R (Rename) or Alt-Shift-V (Move) when your cursor is over the package/class/method/variable. Equivalently, right-click on any package, class, method or variable in the Package Explorer and select Refactor » Rename to rename it or Refactor » Move to put it in another package or class. |
Delete current row | Ctrl-D when cursor is in row to be deleted. |
Mark TODO items for yourself | Start a comment with TODO to leave yourself a note about a piece of code that you need to fix. Eclipse will automatically put the comment in the Tasks pane, the pane where it shows your compile errors. (If you don't see the Tasks pane, use Window » Show View » Tasks.) You can jump to TODO items or compile errors in your code quickly by double-clicking on them in the Tasks pane. |
Generate get() and set() methods | Make sure the fields for which you would like to create get() and set() methods are declared in the class, then right-click and use Source » Generate Getter and Setter. |
Run classes or unit tests that you've run recently | The little "play" icon
![]() |
Turn off console autoraise | When a program run under Eclipse writes to standard out (say, via println), Eclipse raises the "console" perspective. This may be annoying when you run tests, or when you use Continuous Testing. To turn this off, go to Window » Preferences » Run/Debug » Console and uncheck “Show when program writes to standard out”. |
Emacs key bindings | If you prefer
to use Emacs key bindings while editing code, do: Window » Preferences...» General » Keys » Modify and set Scheme to Emacs |