10 Eclipse tricks you should know

Our collection of Eclipse Tips and Tricks keeps growing: Here are some more Eclipse Tips and Tricks you should know!

#1 How to list all eclipse shortcuts

How to display a list of all the keyboard shortcut combinations: Ctrl+Shift+L
eclipse tips and tricks

#2 How to run multiple JVMs in Eclipse.

If you launch multiple JVMs you’ll have the “Display Selected Console” (2) activated. When you choose this option you can select from any of your running applications. Just select the tab, select which application you want it to watch, and repeat for the other tab.
Hint use the Pin Console button (1) to ensure that the current console remains on top of all other consoles.
eclipse tips and tricks

#3 How to turn a String into a System.out

Highlight (or select) a Text. Press Ctrl+Space. Hit End+Enter. the “sysout” snippet is triggered which wraps the selection around as its parameter.

eg. “hello world!” becomes System.out.println(“hello world!”);
eclipse tips and tricks
Also if you type ‘syso‘ then press Ctrl+Space to expand it to:


#4 How to assign a variable/field quickly

Instead of typing:

MyClass c = new |

(| is cursor location):

just type

new MyClass()|

and press Ctrl-2 L, which results in:

MyClass c = new MyClass()|

This really speeds things up. (Ctrl-2 F does the same, but assigns to a new field rather than a new variable.)

#5 How to find the Class hierarchy for a method

Click on a class or method name and press Ctrl+T.

You get a quick type hierarchy. For a class name you see the entire class hierarchy. For a method name you get the hierarchy showing superclasses and subclasses, with implementations of that method distinguished from abstract mentions, or classes that don’t mention the method.
eclipse tips and tricks
This is huge when you are at an abstract method declaration and quickly want to see where it is implemented.

#6 How to wrap long String literals

You can have String literals wrapped when you edit them. For example, if you have code like this:


position your caret whereever you like in the String and press Enter. The code will be automatically changed to:

                "(STATUS_ID, NAME, DESCRIPTION) VALUES " +
                "(100, 'PUBLISHED', 'Pubblicata');";

This behavior can be customized in the Opens the typing preference page Java > Editor > Typing preference page.

#7 Exception breakpoints

One of the very cool things many people don’t know about Eclipse is that it will let you set breakpoints based on where an Exception occurs. This is going to be a huge timesaver! You access the option via the “j!” icon in the debugging window.
eclipse tips and tricks
In the resulting dialog:

In the Choose an Exception field, type a string that is contained in the name of the exception you want to add. You can use wildcards as needed (“* ” for any string and “? ” for any character).
In the Matching types list , select the exception you want to add.
Select Caught and Uncaught as needed to indicate on which exception type you want to suspend the program.

#8 Use content assist

You can use content assist to speed up the creation of fields, method parameters and local variables. With the cursor positioned after the type name of the declaration, press Ctrl+Space.
Ex. List [Control / Space ] will add:

List list;

You can exclude certain types from appearing in content assist, use the type filter feature configured on the Opens the type filter preference page Java > Appearance > Type Filters preference page. Types matching one of these filter patterns will not appear in the Open Type dialog and will not be available to content assist, quick fix and organize imports. These filter patterns do not affect the Package Explorer and Hierarchy views.

For example, it’s quite annoying if you are developing server based applications and you have several List class availables. You can filter out classes like java.awt.List which will not be suggested anymore.

#9 Eclipse is Camel case aware!

Eclipse IDE is aware of CamelCase. You can type class names faster by only typing the upper-case letters:

eclipse tips and tricksThis also works for method names – very convenient for getter and setter methods.

#10 Tweaks to eclipse.ini

I’ve had a noticeable improvement in startup time and overall response times on my Eclipse installation by adding the following to eclipse.ini, at the bottom:


Also, tweak the Xms (initial heap size) and Xmx (maximum heap size) to higher values, depending on your RAM and the number of other running applications.

Do you want more Eclipse tips and tricks ? read Eclipse useful tips and tricks