You are here
Home > eclipse >

Java IDE Eclipse Keyboard Shortcuts

Java IDE Eclipse Keyboard ShortcutsIn this article, we will discuss about one of the favorite IDE for all java developers, the Eclipse. Moreover, as we believe in learning anything from the basics, we will first start learning fundamentals of an IDE. At the end of this article you must feel comfortable working on Eclipse IDE. Equally important, we will discuss about ‘Java IDE Eclipse Keyboard Shortcuts’ in between. Finally, we will conclude our topic with setting up build path and changing JRE versions in Eclipse, which you will be doing multiple times while developing a project.

If you are a Java Developer and using Eclipse IDE in your project, I will suggest you to be master in Eclipse. Since you will be using Eclipse most of the time while developing your project, It becomes mandatory to keep a good hold on it. As much you practice on Eclipse, in return you will save as much time in delivering your project. Here, Eclipse shortcuts will help you a lot in your speedy project development. According to one survey of Eclipse users,  Developers who use Eclipse shortcuts, save much time in writing and delivering the source code. Let’s start discussing our topic ‘Java IDE Eclipse Keyboard Shortcuts’ and much more.

What is an IDE?

IDE stands for Integrated Development Environment. As the name suggests, it provides you a development environment by integrating multiple software at one place. Moreover, it works as an editor software and offers connectivity to different software in a single window. It saves you from multiple manual tasks while working in a project. Consequently, it also saves our development time.

What are the advantages of using an IDE?

However, we are listing below common advantages of using an IDE. In actual, IDE provides you many more advantages.

1) It provides you source code suggestions (less typing, more choosing)

2) Auto generation of code such as fields, constructors, methods, conditions, loops, try, catch, finally, throws etc.

3) Automatic compilation of code (don’t need to set path every time)

4) Automatic importing of packages (don’t need to remember package names)

5) Helps in creating jar, war, ear (don’t need to remember project packaging commands)

6) Helps in connecting with a code repository(such as GitHub, GitLab, SVN, Mercurial, Bazaar etc.)

7) Additionally, we can connect to various software from the IDE (sometimes via plugin installation)

8) Makes developer’s life simple in bug fixing by providing easy debugging

9) Easily resolves jar dependencies of mostly used tools like Maven, Gradle etc.

10) Needless to say, helps developer in delivering project very fast.

What are popular IDEs for Java application development?

Below is the list of Popular IDEs for Java application development. In this list ‘Eclipse’ is used by majority of Java professionals as a free software. However, if we talk about paid software, ‘IntelliJ Idea’ is the mostly used IDE. Since our topic belongs to Eclipse, we will discuss here only about eclipse.

1) Eclipse
2) STS (Spring Tool Suite)
3) IntelliJ IDEA
4) NetBeans

We have used STS(Spring Tool Suite) in our Spring Boot Tutorials at length. All shortcuts of eclipse will also work in STS. If you want to learn how to create a project in STS, you can refer our article ‘How to create a Project in STS‘.

How to setup Eclipse in your system?

Eclipse is an open source software. For a Java Professional, it helps in developing project faster with less typing. Moreover, we also use Eclipse to develop projects in C/C++, PHP, JavaScript, Rust, Scout etc.

How to install Eclipse?

1) Download eclipse from “eclipse.org/downloads
2) Click on “Download Packages”
3) Next, click on “Eclipse IDE for Enterprise Java Developers”
4) Then, click on “Windows x86_64”
5) You will find “eclipse.zip” file is downloaded into your system.
6) Extract it to your favorite drive by using appropriate software.

How to start Eclipse?

1) Go to eclipse installed folder lets say it is “C:\eclipse”
2) Double click on “eclipse.exe” file
3) Select workspace of your own choice.
4) Then click on “Launch” button
5) Eclipse is started, Now you can see the welcome page.

What is a workspace in Eclipse and what is the use of it?

In fact, a Workspace is a folder where you want to store your projects created with the help of Eclipse. Eclipse uses it for storing all plugins, and setups we did during project development. Further, when we launch Eclipse next time, it loads all setups we saved earlier. Moreover, in this folder, Eclipse creates a directory with the name “.metadata”. We can also use it to identify that this folder is an Eclipse workspace. If you delete this folder, eclipse will not be able to recognize your folder as a workspace. Therefore, all setups and projects you created earlier will not be loaded into eclipse.

What is the structure of a Java project in Eclipse workspace?

When you create a java Project using Eclipse IDE, the project structure in workspace will look like below:

Java IDE Eclipse Keyboard Shortcuts

1) src folder : contains .java files that we created from eclipse
2) bin folder : contains .class files that automatically compiled from .java files
3) .settings folder : contains all the setting we did for this project
4) .classpath file : contains the jar files information that attached to this project
5) .project file : contains above information of the project to load when we relaunch the eclipse.

Eclipse Shortcut for Changing Fonts

1) To just increase font size  : press Ctrl  +++
2) To just decrease font size : press Ctrl  —

To change font name, font style and font size
1) click window menu
2) Then, click Preferences menu item
3) Then, click General -> Appearances -> Colors and Fonts
4) Double click basic -> scroll down -> select Text font
5) Then, click Edit button -> select the font name, font style and font size
6) Finally, click “Apply and close” button

Eclipse Shortcuts for speedy development

1) For code drop down : Ctrl + space

2) For getting code help in drop down window : type some partial text and then press ‘Ctrl + space’

3) For adding main method : type ‘main’, then press ‘Ctrl + space’

4) For adding System.out.println() : sysout/sys/syso/sout, then press ‘Ctrl + space’

5) For adding System.out.println(“trace”) : systrace/sys/syst/strace, then press ‘Ctrl + space’

6) For adding System.err.println(); : syserr/sys/syse/serr, then press ‘Ctrl + space’

7) For quick fix or for creating class, field, constructor, method : Ctrl + 1

8) For opening a particular type such as class, interface etc : Ctrl + Shift + T

9) For opening a resource with partial name of the file : Ctrl + Shift + R

11) For Enclosing a block in try-catch : Alt + Shift + Z

12) Going to the matching parenthesis : Ctrl + Shift + P

13) To Search for current cursor positioned word reference in workspace : Ctrl + Shift + G

14) For working line number tab : Ctrl + F10

Eclipse Shortcuts for Executing Java Program

For executing a Java program:  Ctrl +F11

Please note that, If main method is not available in this class, previously executed class will be executed again.

Eclipse Shortcuts for Commenting/Un-commenting

1) For commenting and uncommenting single line  : Ctrl + Shift + C
2) For commenting and uncommenting multiple lines : Ctrl + /, /
3) For commenting and uncommenting multiple lines  : Ctrl + Shift + /, \

Eclipse Shortcuts for code Formatting 

1) For formatting : Select code, then press ‘Ctrl + Shift + F’
2) For indentation of single line : ‘Ctrl + I’
3) For indentation of all lines : ‘Ctrl + A’,  then ‘Ctrl + I’
4) For Moving line down and up : ‘Alt + down arrow’, ‘Alt + up arrow’
5) For Duplicate line  : ‘Ctrl + Alt + down arrow/up arrow’

Eclipse Shortcuts for deleting code  

1) For deleting complete line : Ctrl + D
2) For deleting next word : Ctrl + Delete
3) For deleting previous word : Ctrl + Backspace

Eclipse Shortcuts for generating code  

1) For generating constructor : ‘Alt + Shift + S’, then ‘O’, then ‘Alt + G’
2) For generating getter and setter : ‘Alt + Shift + S’, then ‘R’, then ‘Alt+A'(to select all fields), then ‘Alt+R’
3) For generating toString : ‘Alt + Shift + S’, then ‘S’, then press enter

Eclipse Shortcuts for Editor, Views, Perspectives

1) For moving to next Editor : Ctrl + page down
2) For moving to previous Editor : Ctrl + page up
3) For changing editors : Ctrl + F6 + “hold Ctrl”, then keep pressing F6 for selecting editor, release Ctrl
4) For changing views : Ctrl + F7 + “hold Ctrl”, then keep pressing F7 for selecting view , release Ctrl
5) For changing perspectives : ctrl + F8 + “hold ctrl”, then keep pressing F8 for selecting perspective, release Ctrl

Eclipse Shortcuts of Single Keys

F1 -> for opening help
F2 -> for showing API Documentation of an element (place cursor on element, then press F2)
F3 -> for opening source code of a variable ( place cursor on variable, then press F3)
F4 -> for opening type hierarchy (for checking it’s super classes and it’s members at a time)
F5 -> for refreshing project

Eclipse Shortcuts for Debugging

F5 –> Step Into
F6 –> Step Over
F7 –> Step Return
F8 –> Resume
‘Ctrl + Shift + B’ :  Toggle Breakpoint
‘Ctrl+ Shift + I’  :  Inspect an element

Eclipse Shortcuts for Shortcut Keys

1) To open short cut keys list : Ctrl + Shift + L
2) For Changing Eclipse shortcut Keys : Window -> preferences -> General -> keys

How to set build path in Eclipse?

1) Right click on project
2) Then click on Build Path
3) Configure Build path
4) Click on Libraries
5) Then click on ‘Add External Jars’
6) Select jar file from the required directory
7) Finally, click on Apply and close button.
8) You can see this jar under Referenced libraries in your project explorer

How to change compiler/JRE version in Eclipse?

1) Right click on project
2) Then click on Build Path
3) Configure Build path
4) Then click on ‘Project Facets’ as shown in the screenshot below.
5) Click on Runtimes
6) Unselect jdk check box which is not required
7) Under Facets select required Java version number
8) Finally, click on Apply and close button.

Eclipse JDK Version

Summary

After going through all the fundamentals of an IDE, particularly Eclipse IDE and our main topic ‘Java IDE Eclipse Keyboard Shortcuts’, finally, we should be able to develop Java Projects using Eclipse confidently. Also we have covered almost every point that a Java developer required to know while using Eclipse. Similarly, we expect from you to further extend your learning about Eclipse. Also try to implement them in your project accordingly. In addition, If there is any update in future, we will also update our article ‘Java IDE Eclipse Keyboard Shortcuts’ accordingly. Moreover, Feel free to provide your comments in comments section below.

 

close

2 thoughts on “Java IDE Eclipse Keyboard Shortcuts

Leave a Reply

Top