8 Eclipse Keyboard Shortcuts Essential for Beginners

Joel Lee 06-01-2018

This article was originally written for Eclipse Juno but has since been updated for Eclipse Oxygen.


I recently had two pair-programming assignments, each in Java and each with a separate partner. Going into this without much knowledge, my first partner suggested using Eclipse IDE, and that turned out to be a great choice. If you’re just starting out in Java, Eclipse is the way to go.

In the past, I’d tried learning the notorious VIM editor, but despite all the VIM tutorials out there, I found the learning curve too steep. Eclipse is much easier to grasp: you can see a list of all the files in your Java (or Android for that matter) project in the package explorer, easily navigate to the desired function with the outline window, get suggestions for functions, imports, and more.

Fortunately for me, my first partner taught me a number of useful workflow keyboard shortcuts, which I then passed on to my second partner who knew as little as I did. As newbie-friendly as Eclipse’s interface is, you owe it to yourself to learn these keyboard shortcuts. They’ll boost your productivity even further, guaranteed.

1. Organize Imports (Ctrl + Shift + O)

Whether you’re working with Java’s native libraries and classes or incorporating third-party frameworks into your code, one thing is true: in order to use a class, you have to first import the class before Eclipse will identify it as valid and available for code autocompletion (real-time typing suggestions).

But who has time to memorize every single package path for every single class in every single library? You can let Eclipse handle it for you using the Ctrl + Shift + O shortcut, which automatically imports unrecognized classes in code.

For example, if you have this bit of code:

public class Hello {
  public static void main(String[] args) {
    ArrayList list = new ArrayList();

And then use the Organize Imports shortcut, it becomes like this:

import java.util.ArrayList;

public class Hello {
  public static void main(String[] args) {
    ArrayList list = new ArrayList();

Instead of typing import lines by hand, you can just write code as normal until you see the red squiggly lines Java Exceptions: Are You Handling Them Right? An Exception in programming signifies an exceptional condition in the program execution. It's used when the condition can be handled better elsewhere. Consider the following examples of Java exception handling. Read More (indicating unrecognized classes), then hit the Organize Imports shortcut.

Note that this shortcut also removes unused imports (in cases where you deleted code) and sorts the import statements by package.

2. Correct Indentation (Ctrl + I)

Code readability is important, not only for you (so you can come back at a later time and understand what you wrote) but for anyone else who may look at your code (partners, professors, open source contributors). Proper indentation is essential 10 Most Common Programming and Coding Mistakes Coding mistakes can lead to so many problems. These tips will help you avoid programming mistakes and keep your code meaningful. Read More .

Does your code often look like this?

public void insertHead(int x) {
  Link newLink = new Link(x);
 if (isEmpty())
   tail = newLink;
    head.previous = newLink; = head;
   head = newLink;

Maybe you wrote it that way, or maybe you copy-pasted from elsewhere. Either way, the good news is that Eclipse makes it trivially easy to fix: highlight the portion of code that’s hard to read, then use the Ctrl + I shortcut to instantly bring it to proper indentation:

public void insertHead(int x) {
  Link newLink = new Link(x);
  if (isEmpty())
    tail = newLink;
    head.previous = newLink; = head;
  head = newLink;

You can change how Eclipse handles indentation by going to Window > Preferences, then in the left panel navigate to Java > Code Style > Formatter > Edit… > Indentation.

3. Delete Current Line (Ctrl + D)

When coding in Java, it’s natural to remove entire lines of code at a time. The worst way to do this? Highlight with the mouse, then hit Backspace. The rookie way to do this? Hit the End key, hold Shift, hit the Home key, then Backspace. But the pro way? Simply hit Ctrl + D:

8 Eclipse Keyboard Shortcuts Essential for Beginners java eclipse tips delete line

4. Autocomplete Recommendation (Ctrl + Space)

Java is unfortunately known for being extremely verbose — the names of classes, methods, and variables are some of the longest in the entire programming industry. Typing them all by hand every single time? Not my idea of a fun time.

Here’s what you do instead: type the first few letters of the class, method, or variable you want, then hit Ctrl + Space. This brings up a list of autocompletion recommendations along with method signatures, variable types, and more. Select the right one, hit Enter, and keep coding.

8 Eclipse Keyboard Shortcuts Essential for Beginners java eclipse tips autocomplete

Features like autocompletion are some of the reasons why IDEs trump text editors Text Editors vs. IDEs: Which One Is Better For Programmers? Choosing between an advanced IDE and a simpler text editor can be hard. We offer some insight to help you make that decision. Read More .

5. System.out.println (“sysout” and Ctrl + Space)

When working with console applications How to Save Command Line Output to File on Windows, Mac, and Linux Saving the output of a command to a file is helpful if you're trying to diagnose a problem, and it's super easy to do. Read More , you’ll need to use System.out.println() for printing messages. But because this is so cumbersome, Eclipse has a quick shortcut for you: type “sysout” (without the quotes), then hit Ctrl + Space.

The best part? The cursor is immediately placed within the method call’s parentheses, so you start typing the message right away:

8 Eclipse Keyboard Shortcuts Essential for Beginners java eclipse tips sysout

6. Search Entire Project (Ctrl + H)

When working on large codebases, it’s easy to forget where you declared certain classes, methods, or variables. Instead of wasting time combing through directories by hand, use the Search Entire Project prompt with the Ctrl + H shortcut.

By default, it comes with four search types: File Search, Task Search, Git Search, and Java Search. You’ll mostly use Java Search, which only searches through source files, but the other three can be useful in their own ways.

8 Eclipse Keyboard Shortcuts Essential for Beginners java eclipse tips search

7. Run Application (Ctrl + F11)

The first time you run a new project, you should do it through Run > Run As… > Java Application. But after that, you can speed things up with the Ctrl + F11 shortcut, which runs the current project using the same configuration as the last time the project ran.

8 Eclipse Keyboard Shortcuts Essential for Beginners java eclipse tips run

8. Rename (Alt + Shift + R)

Here’s the thing about class, method, and variable names: once declared, they can get referenced dozens, hundreds, or even thousands of time throughout a project. Now imagine if you ever need to change the name of a class, method, or variable. It could take hours (or days!) renaming every single reference.

Or you can right-click on the name, select Refactor > Rename, type in the new name, and have Eclipse change every single reference in the entire project in a second. Even faster, you can click on the name, hit Alt + Shift + R, type in the new name, and hit Enter. Bam, done!

8 Eclipse Keyboard Shortcuts Essential for Beginners java eclipse tips rename

Other Tips for Beginner Java Programmers

As a Java programmer, you should absolutely understand how the Java virtual machine works and why it allows for cross-platform development. You should also be familiar with core Java concepts, such as how to use exceptions in Java. You can also have fun with Java—create amazing webcam effects with Java and Processing!

And don’t skip these tips for mastering a new programming language 7 Useful Tricks for Mastering a New Programming Language It's okay to be overwhelmed when you are learning to code. You'll probably forget things as quickly as you learn them. These tips can help you to better retain all that new information. Read More .

Whatsapp Pinterest

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. John
    July 22, 2019 at 2:51 am

    if (isEmpty())
    tail = newLink;
    head.previous = newLink; = head;
    head = newLink;

    No, but noooooooooo!! Jesus, the brackets!

  2. Bob
    January 12, 2018 at 6:55 pm

    Ctrl+1, quick fix, the apex of shortcuts.

  3. Mark
    January 7, 2018 at 10:13 pm


    I agree whole heartedly with you.

    I think these sites are mildly sketch.

    I’ve definitely had some situations and the lying.

    I would rather meet someone organically.

    Best regards,

  4. barney
    January 7, 2018 at 7:29 am

    To Makeuseof'
    There is no such thing as a acceptable ad on the internet all ads are unacceptable and intrusive. period. We the public/people pay our Internet provider a fee to have our internet connection and will not pay view websites that is what we pay our internet provider for to use the internet. We also expect the internet to download at the speed of our internet connection and throttling the internet and having and charging for bandwith is wrong and we will not pay extra to have the internet unthrottled and to have extra bandwith, when band with should be unlimited. You lowlifes who are trying to hustle money by advertising on the internet need to realize 1.) You can't earn a living by hustling and dishonest business practices this is whats wrong with our nations economy and socioeconomic and financial system. 2.) YOU NEED TO GET A REAL JOB!!!Be it blue collar or White collar, Hourly or salaried, By the sweat of your brow will you earn your daily bread, not by Hustling.

    • SassyHolly
      January 7, 2018 at 7:45 am

      Sadly, it looks like you don’t know the meaning of a real job. Some of us are actual small business owners who work 7 days a week with barely any sleep just to get over the 6 month hump of no financial gain. Why don’t you get a life and then the rest of us will look into “real jobs” that are obviously making you as miserable and undesirable as you are. Love and light, I hope you find your passion.