CS 1073 Introductory Programming
for Scientific Applications Getting Started with netBeans
Start netBeans:
Start button -> Java Compilers -> netBeans 3.6
New Project (must pick a name for it, for example: mathematics):
Choose Project > Project Manager.
Click New, give the project its name (mathematics), and click OK.
Folder for your project (must pick a name for it):
Create any folder you like, say the following, where instead
of wagner, use your own last name.
C:\Documents and Settings\All Users\wagner
Choose File > Mount Filesystem.
Select the Local Directory node in the wizard that appears and click Next.
On Select Items to Mount page of the wizard, use the folder you created in
item 1 above.
Select the folder (wagner) and click Finish.
The wagner filesystem node appears in the Filesystems window.
The filesystem's sources are added
to the project classpath.
Note: Don't navigate into the wagner directory.
Just select the wagner directory and click Finish.
New Package (must pick a name for it, for example: quadratic):
Right-click the wagner directory node in the Filesystems window
and choose New > Java Package.
In the name field, type quadratic and click Finish.
New Java class (must pick a name for it, for example: Quadratic):
Right-click the quadratic package's node in the Filesystems window
and choose New > Java Main Class.
In the name field, type Quadratic and click Finish.
Enter the Java program itself:
At the ... point enter the following:
double a, b, c;
a = 3;
b = 4;
c = Math.sqrt(a*a + b*b);
System.out.println("c = " + c);
Compile the Java program:
Choose Build > Compile.
The Output window opens at the bottom of the IDE and displays any compiler
output, including compilation errors. You can double-click any error to go
to its location in the source code. (If you wish, you can skip
this step and use "Execute" directly -- if the source is new or has
changes, the system will compile automatically.)
Execute the Java program:
Choose Build > Execute.
The IDE runs the program and prints the output to the Output window. You should see the
following message in the Output window:
"c = 5.0".
Revision date:2004-08-31.
(Please use ISO
8601, the International Standard.)