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) Effortlessly 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:
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.
Java IDE Eclipse Keyboard Shortcuts 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.
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.
ย
2 thoughts on โJava IDE Eclipse Keyboard Shortcutsโ