NetBeans IDE Java Quick Start Tutorial

NetBeans IDE Java Quick Start Tutorial


  1. Start NetBeans IDE.
  2. In the IDE, choose File > New Project, as shown in the figure below.
    NetBeans IDE with the File > New Project menu item selected.
  3. In the New Project wizard, expand the Java category and select Java Application as shown in the figure below. Then click Next.
    New Project wizard: Choose Project
  4. In the Name and Location page of the wizard, do the following (as shown in the figure below):
    • In the Project Name field, type HelloWorldApp.
    • Leave the Use Dedicated Folder for Storing Libraries checkbox unselected.
    • In the Create Main Class field, type helloworldapp.HelloWorldApp.
    New Project wizard: Name and Location
  5. Click 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 HelloWorldApp open.
  • The Navigator window, which you can use to quickly navigate between elements within the selected class.
NetBeans IDE with the HelloWorldApp project open.

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 helloworldapp;

/**
 *
 * @author <your name>
 */
public class HelloWorldApp {

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

}

0 komentar:

Posting Komentar