Java: Netbeans IDE

This entry is part 1 of 54 in the series Learn Java

For developing Java program, we will be using Netbeans IDE, an open source IDE.

Netbeans IDE supports JavaFx, a Java UI framework that let us develop Windows Desktop applications.

First, download Netbeans from Netbeans.org.

Open up Netbeans and click on File -> New Project.  If this is the first time you are runing Netbeans, it will ask you to input the default directory for Java programs.

Set the Project Location as Java such as C:\java.

javaapp

 

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

/**
 *
 * @author daryl
 */
public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
    }
    
}

Netbeans will first help us to create the above template.  In the tradition of creating the first application, let us create a Hello World program.

Add the following line to the main program.

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

The whole program that can print out the Hello World text will look like below.

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

/**
 *
 * @author daryl
 */
public class JavaApplication1 {

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

Click on Run -> Run Project and the output will be similar to below.

javafirst

The output Hello World is shown in the bottom of the screen.

In the template, a package called javaapplication1 is created for us. A Java package is a mechanism for organizing Java classes into namespaces.

Java packages can be stored in compressed files called JAR files, allowing classes to be downloaded faster as groups rather than individually.

Programmers also typically use packages to organize classes belonging to the same category or providing similar functionality.

 

 

Series Navigation
Java: Build and run java program like an executable >>

Leave a comment

Leave a Reply