On Github dSouthard / CSCI5828_Netbeans
CSCI 5828, Presentation 3, Fall 2015
First, need to download the program at Netbeans.org
This program works on any platform with a Java Virtual Machine. This tutorial will use screenshots from Ubuntu running Netbeans 8.0.2. Follow the download instructions on the website.
Assume that you have successfully installed NetBeans on your machine. Start NetBeans. The NetBeans main window should appear, as shown below.
Here are the steps to create a demo project:
Netbeans automatically includes a customizable license header at the top of each new file. It also automatically includes relevant comments before auto-created classes/methods (author, parameter descriptions, etc.)
Here are the steps to create a new Java class in the demo project:
If you start to use classes whose packages have not yet been imported, Netbeans highlights the discrepancy and then suggests importing the class.
You can place your cursor onto the word that is underlined in red, hit Alt-Enter on the keyboard for a list of suggestions on how to correct the error, and then hit Enter again for the program to automatically include the import.
One nice thing about Netbeans is the auto-generated code that is capable of being done by the program. If, in your new class, you had several private variables, as seen in the previous two figures, it is easy for the program to automatically create Getter and Setter methods.
You can either right click on the desired variable and select Insert Code from the menu, or place your text cursor in the word and hit Alt-Insert on the keyboard to immediately bring up the Generate menu.
Netbeans is capable of generator Constructor, Logger, Getter, Setting, toString and other commonly-used methods. Selecting one of these options brings up the associated Generate __ dialog box, which also gives you the ability to generate the same methods for other variables to save you time. It also gives the option to automatically encapsulate the fields!
With just a few seconds and a few clicks on the mouse, the most trivial methods of my class can be created for me!
To compile the project, select Run and choose Compile File, or simply press F9. Providing no errors were found, the Output pane will display a successful build message.
To run the project, select Run and choose Run File, or simply press Shift + F6. The output is displayed in the Output pane.
To insert debugging breaking points, simply click on the line number to the left of the code you are debugging. Netbeans allows for variable watching, stepping through/over code, and running the code to a desired line while debugging.
There are many advantages to using Netbeans, such as the ones listed below:
Netbeans can sometimes be an overlooked IDE, compared to others such as Eclipse. Hopefully this presentation provided some basics on how to use it as well as some reasons to give it a try!