NetBeans IDE Java Quick Start Tutorial

In order to work with NetBeans IDE  , you should have NetBeans IDE and JDK softwares installed on your system .

Below are links available to Download NetBeans IDE and JDK .

Software or Resource Version Required
NetBeans IDE version 7.2, 7.3, 7.4, or 8.0
Java Development Kit (JDK) version 6, 7, or 8


 

Setting Up the Project :

 

  1. Start the NetBeans IDE .
  2. In the IDE choose  File> New Project as shown in below figure :

Step1

3. In the New Project expand the Java category and select Java Application as shown in the figure below . Than click Next :

Step2

4.In the Name and Location page of the wizard , do the following as shown in figure below :

  • In the Project Name field, type HelloWorldProject .
  • Leave the Use Dedicated Folder for Storing Libraries checkbox unselected .
  • In the Create Main Class field, type helloworldproject.HelloWorldProject .

 

cap6

5. Click on finish

The project is created and opened in the IDE. You should see the following components:

  • The Projects window, which contains a tree view of the components of the project, including source files, libraries that your code depends on, and so on.
  • The Source Editor window with a file called HelloWorldProject open.
  • The Navigator window, which you can use to quickly navigate between elements within the selected class.

Step4

Adding Code to the Generated Source File

Because you have left the Create Main Class checkbox selected in the New Project wizard, the IDE has created a skeleton main class for you. You can add the “Hello World!” message to the skeleton code by replacing the line:

            // TODO code application logic here

with the line:

            System.out.println("Hello World!");

Save the change by choosing File > Save.

The file should look something like the following code sample.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package helloworldproject;

/**
 *
 * @author Amit Kumar
 */
public class HelloWorldProject {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
            System.out.println("Hello World!");
    }

}

Compiling and Running the Program

Because of the IDE’s Compile on Save feature, you do not have to manually compile your project in order to run it in the IDE. When you save a Java source file, the IDE automatically compiles it.

To run the program:

  • Choose Run > Run Project.

The next figure shows what you should now see.

Step5

Leave a Reply