Monday, June 17, 2024

Top 15 NetBeans Keyboard Shortcuts for Java Programmers

In Java development there are three big IDEs, IntelliJ IDEA, Eclipse and NetBeans. In the past, I have shared Eclipse keyboard shortcuts and IntelliJ IDEA courses and today, I am going to share keyboard shortcuts for NetBeans, one of the first Java IDE I used in my career. I started doing Java development when JCreator was considered great because it can help with function names on objects but when NetBeans comes with features like built-in Tomcat and built-in profiler, it changed the game and I extensively used NetBeans for both web and mobile application development with J2ME. Since then a lot of water have flown in to Java world, InelliJIDEA become the defacto standard IDE for Java development with Eclipse as close second but unlike what many expected, NetBeans didn't die.

There is still a lot of people and NetBeans fans which use NetBeans for Java development including in post Java 8 world and my today's article is for those people who love NetBeans as I am going to share 20 useful shortcuts to make full use of  NetBeans IDE

You can use these keyboard shortcuts to improve your developer experience while using NetBeans IDE for Java development. It includes typing related shortcuts, coding shortcuts, code completion shortcuts as well as execution and debugging shortcuts. 



20 NetBeans Shortcuts for Java developers

Without any further ado, let' jump into the 20 NetBeans shortcuts which I believe every Java developer should know

1) Ctrl + Shift + O to open a project

2) Alt + Shift + O to go to a file (This is equivalent to Ctrl + Shift + R shortcut of Eclipse which allows you to search for a resource e.g. a file)

3) Shift + F6 to run a Java file, it needs to have a main method to run a file

4) Ctrl + Shift + F5 to debug a Java file, also need main method
This is actually a shortcut to debug the current file. You can also use Ctrl + F5 to debug the main project, the selected project in NetBeans

5) Ctrl + Shift + I to Fix all imports
This will import all the missing classes which are used in current Java source file. This is same as organize import feature of Eclipse and keyboard shortcut Ctrl + Shift + O

6) Ctrl + O to open a Java type
You can use this shortcut to open a particular class, interface, or enum in Java. It is equivalent to Ctrl + Shift + T shortcut of Eclipse. I usually use this shortcut to open a particular class from workspace. 

7) Alt + Shift + O to search for a file and then open it, its equivalent to Ctrl + Shift + Rin Eclipse.

8) Find Usage Alt + F7 to find all occurrence of a particular method call

9) Ctrl + R to rename a class, method or a member variable. It's the key shortcut for refactoring in NetBeans IDE. The Eclipse equivalent of this shortcut is Ctrl + Shift + R

10) Alt + Enter to show hints. You can press this shortcut to ask NetBeans for help to fix a particular compilation error. It will help you to import a class, create a class or with any other work around. Eclipse equivalent of this shortcut is Ctrl + 1, also known as Quick Fix.

11) Ctrl + W to close the current file

12) Ctrl + / to comment line of codes. Just select the lines you want to comment and enter this shortcut. If you want to uncomment them later, just select them again and enter Ctrl + /, same shortcut. This shortcut also works fine in Eclipse.

13) Alt + Shift + F to format the code. Just select the whole file or lines of code you want to format and hit this shortcut. Eclipse equivalent of this shortcut is Ctrl + Shift + F

14) Alt + Enter for content assist or auto-completion

15) Alt + Insert to generate source code e.g. constructor, getter and setter method, override equals(), hashCode(), toString() and compareTo() or to add a property

And, if you need more NetBeans shortcuts then here is a nice NetBeans keyboard shortcut cheat sheet which you can print and put it on your desk for quick reference



That's' all about 15 NetBeans Shortcuts Every Java Programmer Should Know. In this list I have included all kind of keyboard shortcuts like creating and opening projects, files as well as finding certain text in project, finding certain files, find all occurrences of a particularly member variable or method call. 

Other Java Eclipse Articles and Tutorials you May like
  • 30 Useful Eclipse Shortcuts for Java Developers (list)
  • 10 Eclipse debugging tips Java developer should know? (see here)
  • How to attach source code for JAR file in Eclipse? (guide)
  • Eclipse shortcut to print System.out.println statements? (shortcut)
  • How to increase console buffer size in Eclipse? (steps)
  • How to use spaces instead of tabs in Eclipse? (guide)
  • How to remote debug Java application in Eclipse? (tutorial)
  • How to create an executable JAR file from Eclipse? (example)
  • 3 Books to Learn Eclipse IDE for Java developers (list)
  • How to debug Servlet JSP in Eclipse IDE? (example)
  • How to Increase Heap Size of Java Program running in Eclipse? (guide)

Thank you for reading this article. Over to you know, what is your favorite Java IDE? Eclipse, NetBeans, or IntelliJ IDEA?

1 comment :

Anonymous said...

IntelliJIDEA and its community edition is also free

Post a Comment