Netbeans Introduction: Create your first Java Program Using NetBeans
NetBeans is an Integrated Development Environment, or IDE, provided free of charge by Sun Microsystems. It's primarily intended for developing software applications in Java, but its' capabilities extend well beyond coding and well beyond Java. It provides design tools, support for other languages, and even a CVS client.
You can get Netbeans (it's free) here: http://www.netbeans.org/downloads/index.html
This tutorial explains how to use NetBeans to create your first Java program.
Step 1
Start NetBeans.
Click File / New Project.
The New Project Dialog will appear
Step 2
From Categories, select Java.
From Projects, select Java Application.
Click Next.
Step 3
Give the project a descriptive name. Don't fall into the nasty habit of accepting the default name.
Note where it is stored so you can retrieve it later.
Change the case-ing of the class name if you like.
Camel-humped naming is preferable.
Click Finish.
Step 4
Your project will look something like the Step 4 screen shot, below.
Note the TODO; replace it with this code:
System.out.println("Hello World");
Be careful; Java is case sensitive. Any variable name, class name, method name, keyword and almost everything else that's not in quotes is case sensitive.
If anything you type appears with a sqiggle beneath it, you may have made a typing error.
Step 5
Click the Green Arrow on the Tool Bar at the top of the
window.
Unless you made a typing error, Your project will build and execute.
Note the output in the Output Window at the bottom of the
window.
Step 6
Now you will add a class to your project.
Look for the Projects Window at the upper left of the IDE.
Right-Click on the HelloWorld project and select New / Java
Class.
Step 7
Fill in the name of the new class. In this example it’s
called myNewClass.
Select the HelloWorld package from the package drop-down.
Click Finish.
Step 8
Your IDE should look something like this.
Create a method in the class; add the following code.
public void Hello() { System.out.print("Hello from myNewClass"); }
Be careful; Java is case sensitive. Also be sure the method is contained in the class.
Step 9
Add an instance of the new class to the main( ) and call the
method in the new class;
Type the following code:
myNewClass myNew = new myNewClass(); myNew.Hello();
Your code should look something like this.
Step Last
Click the Green Arrow on the Tool Bar at the top of the window.
Your project will build and execute.
Note the output in the Output Window at the bottom of the window.