Eclipse Zone is brought to you in partnership with:

Tomas Kramar lives in Slovakia, where he works for a company developing software for a major local telecommunication provider. He is also a student at the Slovak University of Technology. Tomas has posted 6 posts at DZone. You can read more from them at their website. View Full User Profile

Effective Eclipse: Shortcut keys

  • submit to reddit

You should try to keep your hands on keyboard. The less you touch the mouse, the more code you can write. I am trying to keep the mouse laying still and control the IDE completely using keyboard. What do you think is faster: pressing ALT + C or right clicking the project, selecting Team -> Commit?

It is said, that if a function does not have a key binding, it is useless. Below you will find a set of essential keyboard shortcuts that I love. These shortcuts are set up by default, they should all work.


Delete row. Try it! You no more need to grab the mouse and select the line, no more Home, Shift + End, Delete. Quick and clean.

ALT + Up/Down Arrow

Move the row (or the entire selection) up or down. Very useful when rearranging code. You can even select more rows and move them all. Notice, that it will be always correctly indented.

ALT + Left/Right Arrow

Move to the last location you edited. Imagine you just created a class Foo, and now you are working on a class Boo. Now, if you need to look at the Foo class, just press Alt+Left Arrow. Alt+Right Arrow brings you back to Boo.


Organize imports. What happens when you first use a class you have not yet imported? You will see an error. But when you press this magical combination, all your missing classes will be imported, and the unused imports will vanish.


Probably the most useful one. It activates the quick fix. Imagine you create a class, which implements some interface. You will get an error, because the inherited methods are not yet implemented. While you are on line where the error occurs, press this combination to activate the quick fix. Now, select the "Add unimplemented methods" option. You can use the quick fix at every error you ever receive.

Quick fix comes handy in other situations too. My favorite is the "Split variable declaration". Sometimes I need to broaden the scope of a variable. I activate the quick fix, split declaration, and use alt + arrow to put it where it belongs. You can find even more usages: Convert local variable to field, rename in file, Inline local variable..

You could use the "Split variable declaration" on the bar variable, and then move it with Alt+Arrows above the try block..

Or you could use the "Add unimplemented methods" fix here.

The best thing you can do if you see an error is to use the quick fix.


Open Type. Imagine, that you need to have a look at the Foo class. But, where is the Foo class? Is it in the Boo project and in the package? Or somewhere else? With this shortcut, you don't need to know. Just press it, type Foo and you are in.


Shows you a list of all open editors.


Use to move between open editors. This is an slower alternative to Ctrl + E. Comes handy in a situation when you want to periodically switch between two editors, something, what is nearly impossible with Ctrl+E as it sorts entries quite randomly. Or you might just use Alt+Arrows..


Move between views. When in editor, press Ctrl+F7 to switch to the Package Explorer, or hold Ctrl and press F7 multiple times to switch to other views.


Move between perspectives. The same as previous.

CTRL + F11

Runs the application. What gets launched depends on your settings. It will either launch the last launched class (my preffered way) or it will launch currently selected resource (the default way). If you want to change its behavior read the previous post.


Open new type wizard. This is not very quick because you have to select the wizard type (weather you want to create new class, jsp, xml or something else) in the next step. Much faster way would be if you could just hit the shortcut and invoke the particular wizard. It is possible, just keep reading..


Maximize or umaximize current tab.


Corrects indentation.


Formats code. You can make a beautiful looking code out of a mess with this. It requires a bit of setup, but it is well worth it. You can find its settings under Window->Preferences->Java->Code style->Formatter


Incremental search. Similar to the search in firefox. It shows you results as you type. Don't be surprised, if you hit this combination, nothing happens - at the first glance. Just start typing and eclipse will move your cursor to the first ocurence.


Shows you a list of your currently defined shortcut keys.

I don't like your shortcuts

Such is life nowadays. Remember, you can always change those bindings to match your preferences. Open Windows->Preferences->General->Keys. Now you can use the filter to find your shortcut and change its binding.
The real fun begins when you cannot find the command you are looking for. The key here, is to have the "Include unbounds commands" checkbox checked. It will show you all commands, even those, which have no keys bound.

While you are here, I recommend to add the following bindings:


Bind this to "Generate getters and setters". This is a "must have".


Bind this to SVN/CVS "Commit".


Bind this to SVN/CVS "Update".

Now, type "new" (without quotes) in the filter text. You should see a list of all new type wizards. Choose the most frequently used and assign them a shortcut. For example, the most used wizard for me is the new class wizard. Thus I assigned it the CTRL+SHIFT+N keys.

Let me demonstrate a quick way to create new class now.

Hit CTRL + SHIFT + N (or the combination you assigned in the previous step). This should bring up new class wizard. Type in the name and press ALT+E. You can now select a class which will be a superclass for the newly created class. Hit ALT+A and select all implemented interfaces . Now hit ALT+F and your class will be generated. Eclipse will also provide the default implementation for all abstract and interface methods you inherited.

Did you notice the weird underscores everywhere in the dialog? They give you a hint about the shortcut key. Hit ALT and the underlined letter to press the button, check the checkbox or get focus for a textfield.

Did you notice the underscores?

I think that using shortcut keys is the fastest way to productivity and if not, then at least your wrists will say you a silent thanks. Now, don't wait, go on and assign keys to the features you use most.

One final tip from Andriy:

The problem is that there are so many keyboard shortcuts. I used to keep a printout with all the shortcuts I wanted to use. Finally I wrote an Eclipse plugin MouseFeed, which reminds the keyboard shortcuts for the actions called with mouse. You can even tell it to enforce some shortcuts - the action will run only if called with a keyboard shortcut.

So if you are struggling with yourself, if you want to use shortcuts, but always subconsciously touch the mouse, install the plugin and let it enforce the shortcuts - the mouse will be useless and you will be forced to use keyboard.

What shortcuts do you use?

Published at DZone with permission of its author, Tomas Kramar. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)



Mark Haniford replied on Fri, 2008/02/15 - 7:48am


Cole Markham replied on Fri, 2008/02/15 - 10:15am

Very good overview of the most useful shortcuts. I really like the new class shortcut, I find myself wanting that all the time, and I always forget that almost everything in Eclipse can have a key binding even if it doesn't already.

One thing I noticed is that you map CTRL+SHIFT+G to "Generate getters and setters". That's a great shortcut, and I am about to set a key binding for it. But CTRL+SHIFT+G is mapped to "References->In Workspace" which I use all the time. Place your cursor on a class, variable or method and fire the action. This will show in the Search view all references of that item throughout your workspace. Very useful when you are trying to understand code.

A few more that I use religiously:

CTRL+ALT+H Open Call Heirarchy. Find out where that method is used.

F4 Open Type Heirarchy. See the subclasses and/or superclasses. This one can be tricky sometimes. If there is a class under the cursor it will open that class's heirarchy, if not it will use the class that contains the cursor (including inner classes).

F3 Open Declaration. Jump to the declaration of the variable, method or class. It will try to find the most specific declaration it can for methods, but depending on your code you might end up in an Interface which is probably not what you want. Then just press F4 to get the type heirarchy and find the implementation you are looking for.

ALT+SHIFT+R Refactor->Rename. Works in the editor and in the package explorer. If you haven't learned the power of refactoring, do so now. Think of this one as a super-smart Find-Replace. The new 3.3 feature of inline rename is awesome.

ALT+SHIFT+V Refactor->Move. Again, works in both the edtor and package explorer. Move the method or field to another class.

ALT+SHIFT+M Extract to method. Break up that monolithic code, takes the selection and trys to make it into a method. Will optionally find duplicate code blocks and use the new method there as well. It might take a few trys to get this to work the way you want. Just try it, rearrange thee code a little and try again.


David Karr replied on Fri, 2008/02/15 - 11:19am

Two things:

On "Ctrl-N" to create a new object, it is annoying that you then have to select the appropriate wizard, but after you press Ctrl-N, there's another shortcut that helps here.  You simply start typing the type of object you want to create, like "class", and it narrows the list to the relevant items, then you press Enter. 

 The next point is a question: What is "Split variable declaration"?  I can tell from its name what it does, but I can't find a function in Eclipse that does this.

Vijay Aravamudhan replied on Fri, 2008/02/15 - 11:30am

Nice compilation. Another complimentary tool for power eclipse users would be the MouseFeed plugin:

The plugin and the list above should be used in a complimentary fashion - since I dont think all the ones mentioned above show up in the plugin.

DISCLAIMER: I am in no way associated with the developer(s) of the plugin - just another user of the same.

Jeremy Weiskotten replied on Fri, 2008/02/15 - 2:51pm

Along with Ctrl+1, Ctrl+Space is one of my favorites. Start typing something, and hit Ctrl+Space and chances are that Eclipse has a hint about what you're doing. For example, type "for" and hit Ctrl+Space to generate a for loop (you can choose from the various types of iteration).

Tomas Kramar replied on Fri, 2008/02/15 - 5:55pm in response to: David Karr


I don't think that the "Split variable declaration" function can be accessed via menus. It is part of a quick fix feature - more on it later..

Just to make it clear:

when the "Split variable declaration" is applied on

Integer count = new Integer(22);

the result is

Integer count;
count = new Integer(22);

David Karr replied on Fri, 2008/02/15 - 8:36pm

Hmm, is "Split variable declaration" only available in 3.4?  I'm on, and I'm not seeing it.

Cole Markham replied on Sat, 2008/02/16 - 4:51am in response to: David Karr

It's been around for a while, not sure how long, but I'm using it in 3.3. It's in the Quick-fix menu like Tomas mentioned, press CTRL+1 while the cursor is on the variable name to access it.

There is also the inverse, "Join Variable Declaration" perform the inverse. The variable must not have an assignment for it to be available. Something like this will not work:

Integer count = null;
count = new Integer(23);

Be careful if there is something else in between though. Here's an example:

Integer count;
count = Integer.valueOf(18);
count = new Integer(23);

will convert to this:

Integer count = Integer.valueOf(18);
count = new Integer(23);

That is almost certainly not what was intended. Actually, that seems like a bug. I'll go check out bugzilla and file a report if it's not there.

EDIT: I found this bug which describes a similar issue with "Join variable declaration" and was marked as WONTFIX. The reasoning is that the tool is intended to be simple and useful, not necessarily always produce code that will compile (try running it from the variable inside the if statement, it pulls the declaration in there so subseqeunt accesses break). As such, I decided against filing another bug. Just be careful what you are trying to do when you use this one.

Tomas Kramar replied on Sat, 2008/02/16 - 5:42am in response to: Cole Markham

Maybe they are right, anyway, it is easy to press alt + arrow down to move it to the correct position.

Raffaele Gambelli replied on Mon, 2008/02/18 - 9:28am in response to: Tomas Kramar

Hi Tomas, hi all!


And what do you think about the super new from Europa version CTRL + 3 shortcut? 

It is an entry point for pratically everything inside Eclipse, fantstic in my opinion and very useful.


Best regards




Tomas Kramar replied on Mon, 2008/02/18 - 3:17pm in response to: Raffaele Gambelli

Raffaele, this one is great! I didn't know about it, it is awesome.

yqouyang replied on Tue, 2008/03/18 - 6:15am

Tomas and all you guys . thanks very much for tell me so much shortcuts I dont know.

bhagwan tayade replied on Mon, 2009/01/19 - 3:53am

hi Thomas , its nice to visit u r website. i solved my some problems by using this eclipse.dzone.

Stephane Eybert replied on Tue, 2009/03/03 - 3:47am

The thing that I miss most is being able to change focus to the currently hovered view, so as to be able to scroll the hovered view with the mouse central scroll button.

 As things are now I have to first click in the view to focus it. Spare my poor fragile hand please...

jaga india replied on Thu, 2009/03/19 - 10:03am

hi to every one, first time log in to this site

Muhammad Ali replied on Fri, 2009/04/10 - 2:42am in response to: Raffaele Gambelli

How can we forget about CNT+0....

Muhammad Khojaye replied on Tue, 2009/04/14 - 12:19am in response to: Mark Haniford

Go to line number N in the source file: Ctrl + L, enter line number

Go to the last edit location: Ctrl + Q for .

Go to a supertype/subtype: Ctrl + T



Muhammad Khojaye replied on Tue, 2009/04/14 - 12:19am in response to: Mark Haniford

Go to line number N in the source file: Ctrl + L, enter line number

Go to the last edit location: Ctrl + Q for .

Go to a supertype/subtype: Ctrl + T



Rick Reumann replied on Tue, 2009/09/29 - 1:52pm

In regard to CTRL-F6 why did you mention " This is an slower alternative to Ctrl + E."  To me, CTRL-F6 is a much 'faster' alternative to CTRL-E.

 CTRL-E has things in some weird order whereas ctrl-F6 will first return you back to the last editor window (which is typically what I want), or if not that last one, usually one of the ones I've just worked on is near the top of the list.

 How is ctrl-F6 slower than Ctrl-E ? Ctrl-F6 seems much more useful to me (I actually rebind it to ctrl-tab )

Arun Ramakani replied on Wed, 2009/11/25 - 1:12am

Good work

Lajos Doma replied on Wed, 2009/12/09 - 6:46am

Nice article!

I also found it useful to attach shortcut-keys to pre-configured perspectives. See my blog-entry: Eclipse: quickly change perspectives with keyboard shortcuts

Ohad Nahum replied on Thu, 2010/12/30 - 12:27am

Thanks for the overview - very helpful. Maybe someone knows how to add a shortcut key that will insert some lines of texts ? I want to insert a text template into my code whenever I press a shortcut key.

Javin Paul replied on Fri, 2011/04/08 - 9:30am

here is my list of Top 20 eclipse keyboard shortcuts I would rather say very useful and practical eclipse shortcut :) and I used it on day to day basis.

Sandeep Bhandari replied on Wed, 2011/12/07 - 3:54am

Eclipse has 100 of shortcuts and the point is how many of them do we use frequently. I posted most used eclipse shortcuts at  Eclipse Shortcuts

Matthieu Mosch replied on Wed, 2012/02/15 - 2:40am


i especially love ctrl-F6 and bound it to ctrl-tab now

i also use extensively : ctrl-/ for toggling selected code lines into comment

Jeremy Solarz replied on Thu, 2012/04/12 - 2:38am

Additionally to the shortcuts above I use the following shortcuts as well

 Next/Previous Editor Window

 Ctrl + Page Down / Ctrl + Page Up

 Project / Editor View

 To change between project / editor views

 Ctrl + Insert (Show View Project Explorer) / Ctrl + Delete (Activate Editor)

 Duplicating line

 I have moved the command Crtl + D, to delete a line. And use Crlt + E for Duplicating a line

 You can find it under Preferences > General > Keys if you search for "Duplicate Lines"

 Close current Editor 

 Ctrl + W 


  I try to keep my opened Editor windows to a minimum to don't get overwelmed by them after time.



Carla Brian replied on Wed, 2012/05/09 - 9:26am

This is also what my friend advised also. It is really effective and it is much easier than the longer process. - Dr Marla Ahlgrimm

Mario Lopez replied on Fri, 2012/11/30 - 2:32pm

I think shortcuts like these are helpful overall, but sometimes I still find it easier sometimes to just use the regular controls. But maybe that's because I am an old-time user :-) I also still have a very slow computer because it's so old, I'm still hanging in there with speed up computer tricks  to keep the speed high enough to load websites and stuff haha

Karthik Ramachandran replied on Thu, 2013/04/25 - 12:44am

 hi good job.

keep posting..............

Subhankar Chakr... replied on Thu, 2014/07/10 - 4:40pm

How to clean the server using keyboard shortcut????

How to automatic clean the server in Eclipse?????

I am taking abount WildFly sever 8.0 in Eclipse.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.