Sunday, August 20, 2023

Top 30 Eclipse Keyboard Shortcuts for Java Programmers [UPDATED]

Hello guys, if you use Eclipse for Java development and looking to increase your productivity then you have come to the right place. Earlier, I have shared the 5 best Eclipse courses and in this tutorial, I will share 30 Eclipse keyboard shortcuts to improve your productivity. This list is by no means complete, and I will suggest you guys share eclipse shortcuts listed other than here to make this more useful. Eclipse is the most used Java development IDE, and knowing these Eclipse shortcuts not only improves your productivity but also makes you more efficient. You will have more time for things you like to do. Using keyboard shortcuts also helps to impress colleagues and shows that you have a good hold on tools you used for Java Development.
If you are a Java developer, who use Eclipse as your main IDE for all-purpose like coding, development, and debugging, then I also suggest you take a look at Beginners Eclipse Java IDE Training Course, one of the best course to learn how to use Eclipse effectively from Java programmer's perspective.

I was a big fan of Netbeans IDE before I came across Eclipse. One of the main reasons for that was my 2ME background, and Netbeans provide a sophisticated IDE environment to enable you to build, debug and run your Java application in various mobile emulators including some advanced processing options like preprocessing, setting up Exception breakpoint, etc. 

From that time, I love to know keyboard shortcuts on IDEs and other tools I used for development, including Edit Plus, Notepad++, Microsoft Excel, etc. Knowing your tools better certainly helps you to deliver more in less time and find something really quick when a production issue arises. 

As I said, I was a big NetBeans fan at the start of my career but when I joined an investment bank I came across Eclipse IDE since everybody in my team is using Eclipse and Netbeans IDE was not available in the company (don’t know why NetBeans was not allowed even though it was free) I have decided to go Eclipse way.

Later I found that Eclipse is most suited for that distributed core Java application, which runs on Eclipse and depends upon a proprietary Linux library. It wasn't possible to run the whole application in Windows, and at that time some of the cool features of Eclipse like. Remote Debugging, Conditional Breakpoints, Exception breakpoints, and Ctrl+T and Ctrl+R kind of shortcuts really saved my life.

Here I am sharing a list of 30 Eclipse keyboard shortcuts, which I found most useful and used in my day-to-day life while writing code, reading the code, or debugging Java application in Eclipse. Btw, if you are new to the Java world, I suggest you first learn Java by joining a comprehensive course like The Complete Java Masterclass on Udemy, which is recently updated to cover the latest Java version. 




30 Useful Eclipse Keyboard Shortcuts for Java Programmers

Here is my list of 30 chosen Eclipse IDE keyboard shortcuts for Java developers. It's useful for both core Java developers and Java web application developers using Eclipse IDE for web development.

1)      Ctrl + Shift + T for finding a class even from a JAR file
This keyboard shortcut in Eclipse is my most used and favorite shortcut. While working with a high-speed trading system that has a complex code, I often need to find classes in the just blink of an eye, and this Eclipse keyboard shortcut is just made for that. No matter whether you have a class in your application or inside any JAR in the workspace, this shortcut will find it.


2)      Ctrl + Shift + R for finding any resource (file) including config xml files
This is similar to the above Eclipse shortcut with the only difference that it can find out not only Java files but any files, including XML, configs, and many others, but this eclipse shortcut only finds files from your workspace and doesn’t dig at the JAR level.


3)      Ctrl + 1 for quick fix
This is another beautiful Eclipse shortcut that can fix up any error for you in Eclipse. Whether it’s missing declaration, missing semi-colon, or any import-related error, this eclipse shortcut will help you to quickly sort that out.


4)      Ctrl + Shift + o for organize imports
Another Eclipse keyboard shortcut for fixing missing imports. Particularly helpful if you copy some code from other files and what to import all dependencies. 

You can further see The Eclipse Guided Tour - Part 1 and 2 on Pluralsight to learn more about code formatting shortcuts in Eclipse.


Top 30 Eclipse Keyboard Shortcuts for Java Programmer



Btw, you would need a Pluralsight membership to access this course, which costs around $29 monthly or $299 annually. I have one, and I also suggest all developers have that plan because Pluralsight is like NetFlix for Software developers.

It has more than 5000+ excellent quality courses on all the latest topics. Since we programmers have to learn new things every day, an investment of $299 USD is not bad.

Btw, it also offers a 10-day free trial without any obligation, which allows you to watch 200 hours of content. You can watch this course for free by signing for that trial.


Eclipse Shortcut for Quick Navigation

In this section, we will see some eclipse keyboard shortcut which helps to quickly navigate within the file and between file while reading and writing code in Eclipse.

7) Ctrl + o for quick outline going quickly to a method

9) Alt + right and Alt + left for going back and forth while editing.

12) Alt + Shift + W  to show a class in the package explorer

13) Ctrl + Shift + Up and down for navigating from member to member (variables and methods)

15) Ctrl + k and Ctrl + Shift +K for find next/previous

16) Go to a type declaration: F3, This Eclipse shortcut is very useful to see function definition very quickly.

Apart from these keyboard shortcuts, learning how to debug a Java program in Eclipse is also a skill. There are so many debugging tools and features available in Eclipse, which many Java programmer doesn't know like conditional debugging, hit count, and remote debugging. 

If you really want to become a good Java developer, I suggest you improve your debugging skill, and if you need some help with Eclipse Debugging Techniques And Tricks are the best place to start with.

Java Eclipse shortcuts and tips



Eclipse Shortcut for Editing Code

These Eclipse shortcuts are beneficial for editing code in Eclipse:

5) Ctrl + / for commenting, uncommenting lines, and blocks, see here for a live example.

6) Ctrl + Shift + / for commenting, uncommenting lines with block comment, see here for example.

8) Selecting class and pressing F4 to see its Type hierarchy

10) Ctrl + F4 or Ctrl + w for closing current file

11) Ctrl+Shirt+W for closing all files.

14) Ctrl + l go to line

16) Select text and press Ctrl + Shift + F for formatting.

17) Ctrl + F for find, find/replace

18) Ctrl + D to delete a line

19) Ctrl + Q for going to the last edited place


You can further see Eclipse IDE for Beginners: Increase Your Java Productivity to find live examples for most of these shortcuts. It's a free course on Udemy, so you don't need to pay for anything.

Java debugging shortcuts Eclipse



Miscellaneous Eclipse Shortcuts

These are different Eclipse keyboard shortcuts that don’t fit on any category but quite helpful and make life very easy while working in Eclipse.

20) Ctrl + T for toggling between supertype and subtype

21) Go to other open editors: Ctrl + E.

22) Move from one problem (i.e., error, warning) to the next (or previous) in a file: Ctrl +. For next, and Ctrl +, for the previous problem

23) Hop back and forth through the files you have visited: Alt + and Alt + , respectively.

25) CTRL+Shift+G, which searches the workspace for references to the selected method or variable

26) Ctrl+Shift+L to view the listing for all Eclipse keyboard shortcuts.

27) Alt + Shift + j to add Javadoc at any place in the Java source file.

28) CTRL+SHIFT+P to find a closing brace. Place the cursor at the opening brace and use this.

29) Alt+Shift+X, Q to run Ant build file using keyboard shortcuts in Eclipse.

30) Ctrl + Shift +F for Autoformatting.

If you need to see these shortcuts in action, you can also join The Eclipse Guided Tour - Part 1 and 2 online courses on Pluralsight. It's not free but costs you around a $29 monthly subscription fee but also gives you access to more than 5000 courses on Pluralsight on the latest technology, which is totally worth it.

Remember, programmers are technical people, if you are not learning which means you are going backward.  
If you're a developer, you owe it to yourself to have a @pluralsight subscription. Sometimes, you need the flexibility to take many courses without buying each one of them. 

And, here is a nice image to remember these useful Eclipse shortcuts for Java programmers:

Useful Eclipse Shortcuts for Java Developers


If you have some more useful Eclipse keyboard shortcuts, then please post them as comments, I will include them in this list. These Eclipse shortcuts will mostly work with almost all Eclipse versions e.g., 3.5, 3.6 Helios, Eclipse Ganymede, and Indigo. Let me know if you face any issues while using these Eclipse shortcuts in any particular version of Eclipse IDE.

Related Eclipse tutorials for Java Developers

If you like this tutorial and wants to learn more productivity tips, tricks, and new features of Eclipse IDE, then you can also see the following guides and tutorials:
  • How to attach the source code of a JAR file in Eclipse? (steps)
  • How to debug a Java Program in Eclipse IDE? (guide)
  • How to do the static import in Java Eclipse? (solution)
  • How to solve Eclipse No Java Virtual Machine found the error? (solution)
  • How to fix the JAR dependency not working in Eclipse Maven Plugin? (answer)
  • How to fix Eclipse Not able to connect Internet or Market Place error? (solution)
  • How do you create JUnit tests in Eclipse IDE? (guide)
  • Eclipse shortcut for System.out.println() statements (shortcut)
  • How to escape String literal in a Java file when posted on Eclipse? (solution)
  • How to compare two files in Eclipse IDE? (guide)
  • How to increase the console buffer size in Eclipse? (solution)
  • How to make an executable JAR file in Eclipse? (steps)
  • How to fix an Unsupported major.minor version 51.0 error in Eclipse? (solution)
  • How to fix must override superclass method error in Eclipse? (solution)
  • How to decompile class files in Eclipse? (solution)
  • How to set java.library.path in Eclipse IDE? (steps)
  • Step by Step Guide to Remote Debug a Java Application in Linux (guide)

Thanks for reading this article so far. If you like these Eclipse keyboard shortcuts, then please share this article with your friends and colleagues. If you have any questions or feedback, please drop a note.

P.S. - If you are looking for some free online courses to learn Eclipse better and improve your productivity then I suggest you check out this list of 6 Free Courses to Learn Eclipse and JUnit which not only teach you Eclipse better but also introduce you to JUnit, one of the most popular Java testing library.

33 comments:

  1. Good list of short cuts. Should have mentioned Ctrl-Shift-L to get this list and Ctrl-Shift-L twice to customize it.

    ReplyDelete
  2. 1) Ctrl + T for finding class even from jar

    Ctrl + T is the shortcut for Quick Hierarchy (Show the quick hierarchy of the selected element)

    ReplyDelete
  3. 1) Ctrl + Shift + T for finding class even from jar
    2) Ctrl + Shift + R for finding any resource (file) including config xml files

    ReplyDelete
  4. Thanks for your comment Anonymous. yes Ctrl + Shift + T can be used to find classes from jar and that's what the difference between Ctrl + Shift + T and Ctrl + Shift + R. I also used Ctrl + Shift + T to findout which class comes first in classpath and its very useful if you have two classes with same name in two jar's and both jar in your classpath and one of them work and other doesn't.

    ReplyDelete
  5. Thanks for your comment Keyboard shortcuts I visited your site and it has really good collection of keyboard shortcuts for various technology including eclipse 3.0.

    ReplyDelete
  6. Thanks Gautam for informing us about Ctrl-Shift-L. I have included in main list for benefit of we all.

    ReplyDelete
  7. Thanks Anonymous, Its good to know that these eclipse keyboard shortcuts are useful for you.

    ReplyDelete
  8. To go along with #28 Ctrl+Shift+P, I find Alt+Shift+UpArrow or Alt+Shift+DownArrow useful when both braces are not visible on the same screen.

    Place the cursor next to the brace you want to match, then Alt+Shift+UpArrow and the matching braces and the code in between will be highlighted. Pressing Alt+Shift+UpArrow again expands the selection further. The highlighting can make brace matching much more evident.

    Furthermore, this highlighting can be used on any logical block of code - put the cursor in the middle of any word (a string, a method,...) and try it.

    ReplyDelete
  9. Ctrl+j = incremental search is superior to Ctrl+f and essential for code navigation, means just Ctrl+j and type on. It will jump to the first match. Use Ctrl+j or Arrow down for the next match and Ctrl+Shift+j or Arrow up to move backwards

    //Gilbert

    ReplyDelete
  10. @Anonymous thanks for your valuable suggestion, this eclipse shortcut indeed sounds quite useful , going to try it.

    ReplyDelete
  11. ctrl+shift+l displays list of all keyboard shortcuts

    ReplyDelete
  12. Thanks Javin for this nice post. I've also compiled a list of useful Eclipse Keyboard Shortcuts and also uploaded a video showing how to use these shortcuts while programming.

    Eclipse IDE Keyboard Shortcuts for Developers

    ReplyDelete
  13. My Favroties :

    Eclipse shortcuts to comment and uncomment
    Eclipse shortcut to formatting
    Eclipse shortcut to finding Type information
    Eclipse shortcut to remove all unused imports
    Eclipse shortcut to run Java program
    Eclipse shortcut to debug Java program

    Thanks
    Soya

    ReplyDelete
  14. What is Eclipse shortcut for static import in Java 5 ? is there any keyword shortcut to go from top of the page to bottom of page in Java Editor window ?

    ReplyDelete
  15. is there any book to learn Eclipse IDE? I want to master this IDE and increase my productivity by learning lots of tips, tricks and shortcuts. please let me know, if there is any comprehensive tutorial or book exists for Eclipse.

    ReplyDelete
  16. One of the keyboard shortcut I often use is Alt +Shift +s and Generate getter and Setters to generate automatic code mainly getter and setter.

    ReplyDelete
  17. For editor i find very useful CTRL + ALT + up(or down) to duplicate a line (or all lines selected)
    also CTRL + D to delete a line (or all lines selected) is very useful

    ReplyDelete
  18. Ctrl + Home go to top of the document
    Ctrl + End go to bottom of the document

    ReplyDelete
  19. F12 to switch back to editor

    ReplyDelete
  20. HI .. Use Ctrl + Shift + / (from Numpad) to shrink all methods at once
    and Ctrl + Shift + * (from Numpad) to expand all shrinked methods

    ReplyDelete
  21. alt+shift+s+r---- for setters and getters
    alt+l to select

    ReplyDelete
  22. To get Ctrl + Tab with most recent used (MRU) behaviour, change key shortcuts:
    "Next Editor" = Ctrl + Tab
    "Previous Editor" = Ctrl + Shift + Tab
    First thing I do in every Eclipse installation.

    ReplyDelete
  23. I mostly use Ctrl + Shift + F to format source code in Eclipse.

    ReplyDelete
  24. CTRL+E To navigate between open editor tabs.

    ReplyDelete
  25. sysout+crtl+space=System.out.pritln

    ReplyDelete
  26. @Unknown, good one, I used it daily :-)

    ReplyDelete
  27. What is the short key for write public static void main(String args[])

    ReplyDelete
  28. This is an awesome java cheat sheet!
    These shortcuts really help me out coding faster:
    Ctrl + o
    Ctrl + l
    Ctrl + Shift + Up

    I need to print them out!

    ReplyDelete
  29. Explain -Xms and -Xmx in eclipse

    ReplyDelete
  30. Whats the command for redirecting to the another abstract class.

    ReplyDelete
  31. scanner s = new scanner(system.in); //after creating scanner

    String name = s.nextString(); // need shortcut key for this

    ReplyDelete