My Favorite Eclipse Shortcuts

Many Java developers use Eclipse as their IDE. When you spend so much of your day in the same application, you start picking up keyboard shortcuts to save time. I use most of these without thinking any more.

(These are the Mac versions of the shortcuts. Most are slightly different on Windows).

  • Control-Space: Auto-complete what you are typing in the editor.
  • Command-Shift-R: Open Resource dialog. After opening this dialog, you can easily open a file in any of your projects by typing and then pressing Return.
    • You can type the beginning of the file name and it will narrow down the list of results.
    • You can use * as a wildcard. For example, *DaoTest will find files such as “”. There is always an implicit wildcard at the end of your search.
    • You can type (in uppercase) the initials of the file. For example, for CategoryDaoTest you could type “CDT”.
    • If the initials search still finds too many results, you can type the beginning of each word. For example, “CatSerBea” would find “CategoryServiceBean” and not “CodeStyleBot”
  • Command-Shift-T: Very similar to the previous, but the dialog that opens allows you to choose any “type”, including classes in dependent JAR libraries.
  • Command-O: Open a quick outline of the current file being edited. You can then type the first few letters of the method, class, or variable you want to jump to.
  • F3: Open the class or variable currently selected.
  • Command-F11: Debug
  • Command-Shift-F11: Run
  • Option-Up, Option-Down: Move the selected line(s) up or down. This is nice because (if the editor supports it), the indentation is automatically fixed for you.
  • Command-Option-Up, Command-Option-Down: Copy the selected lines up or down.
  • Command-D: Delete the selected line.
  • Command-/: Comment out the selected line.


One final thing. Templates. Templates in Eclipse are a wonderful thing. They allow you to easily insert oft-used code. For example, open a Java file and find a line where you want to insert a print-line statement. Rather than typing out the full “System.out.println(…)”, try typing “syso” then auto-complete (Command-Space). Here are a few more:

  • foreach: The Java “for(String val : stringsList) {}” loop
  • syserr: System.err.println();
  • syso: System.out.println();
  • try: Try-catch clause.