An Introduction to Java Development with NetBeans IDE

cabbagepatchtexasSoftware and s/w Development

Jun 5, 2012 (5 years and 7 months ago)

440 views

An Introduction to Java Development with NetBeans IDE
A NetBeans IDE Project Basics Tutorial

by Dirk Schreckmann
In a nutshell, what is the NetBeans IDE?
N
etBeans IDE is a free, open source, popular (with approximately 1 million downloads), integrated
development environment used by many developers. Out of the box, it provides built-in support for
developing in Java, C, C++, XML, and HTML. And this author especially likes the support for editing
JSPs, including syntax highlighting, HTML tag completion, JSP tag completion, and Java code
completion.
NetBeans IDE is available for free downloaded at http://www.netbeans.org
Following are step-by-step instructions to help NetBeans IDE greenhorns to get started developing Java
applications with NetBeans IDE. The basic steps described are as follows.
1.Create a new project
2.Mount a directory - specify a location to save project files
3.Add a new class to the project
4.Compile and run a Java program
1. Create a New Project
Start NetBeans.
Start a new project: Main Menu -> Project -> Project Manager -> New Project



Give the project a name. Click OK.


etBeans IDE is available for free downloaded at http://www.netbeans.org
Following are step-by-step instructions to help NetBeans IDE greenhorns to get started developing Java
applications with NetBeans IDE. The basic steps described are as follows.
1.Create a new project
2.Mount a directory - specify a location to save project files
3.Add a new class to the project
4.Compile and run a Java program


Click New.

Under Filesystems, Select Local Directory. Click Next.


Give the project a name. Click OK.

2. Mount a directory - specify a location to save project files
To specify a location on a disk drive where project files will be stored, mount a directory as part of the
p
roject.
To the
p
ro
j
ect, add a director
y
to hold
p
ro
j
ect files: Main Menu -> File -> Mount Files
y
stem...


Select a directory to hold the project. (Note: Don't open the desired directory, just select it. If you
accidentally open the desired directory, just click the up directory arrow next to the "Look in" drop
down list, and then select the desired project directory with a single click.) Click Finish.


3. Add a new class to the project
Ri
g
ht mouse click on a mounted
p
ro
j
ect director
y
. Select New -> Java Class

Edit the Java class as desired. Following is the code used in this tutorial.



public class Foo
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
N
ame the class and click Finish.
Go to Main Menu -> Build -> Execute to compile and run the main Java class in one step.

N
ote: To just compile a class, go to Main Menu -> Build -> Compile.
After executing, you should see results similar to the following. (Note that the NetBeans IDE captures
console output, not unlike JBuilder. So, the output of this program appears in the lower IDE panel.)

Resources
Again, NetBeans IDE is available for free download at www.netbeans.org
For further information and assistence on using NetBeans IDE, visit The NetBeans Community and
don't forget to mosey on over to The IDEs and Other Tools Forum in the JavaRanch Saloon.




4. Compile and run a Java program
In the Files
y
stems Ex
plorer, assure that the main Java class is selected.