Tuesday, January 24, 2012

Hello World! using NetBeans IDE 7.1

To verify our installation of NetBeans 7.1, we are going to create a helloworld using NetBeans.

- Click File -> New Project... in NetBeans IDE top menu.

- Select Java from Categories, and Java Application from Projects. Then click Next.
New Java Application

- Enter helloNetBeans in Project Name field, make sure both checkbox of Create Main Class and Set as Main Project is checked. the Main class name will updated automatically when we enter Project Name. Click Finish.
Enter Name and Location

- A default project will be generated for you.
Auto generated code

- Modify the code in main() to say something.
public class HelloNetBeans {

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


- Final Save(File -> Save), Build (Run -> Build Project) and Run (Run -> Run Main Project). If everything go correctly, you can see the word "Hello World! from NetBeans." in the Output windows, that means your installation is properly.
Hello World shown in Output window

Related Article:
- How to run NetBeans compiled program

No comments:

Post a Comment

Post a Comment