
How to Use Existing files with NetBeans
by Larry Arnoldy
Frequently you will wish to work
with existing Java source files to see how they were written or to test
how they run. You may wish to use a existing file as a starting point
for a new project. To work with these existing files, you must mount
the
directory (or filesystem as NetBeans refers to them) in which they are
located.
Step 1 - Determine which files that you wish to work
with.
Let's suppose that you wish to examine,
compile, and run some of the Java applications that came with the
Wu textbook.
Let's also assume that you have already downloaded them from
a website or you have copied them from a CD to a location on your PC.
If
they were originally in a zip format, let's also assume that you have
unzipped them.
In this example, the Java source files are located in the following
directory. It is not necessary to actually navigate to the directory
with a file explorer program, but you must know where the files are.
Step 2 - Start NetBeans if you have not already done so.
Double click the desktop
icon

or click on the
Start button
and navigate to the
program name.
Step
3 - Choose a project for the files.
There are three possibilities
- Use the currently open project. In this case you can go on
to step 4.
- You can create
a new project. (Click on the link for instructions if needed).
- You can open an existing project. To open an existing project
click on Project, then on Project Manager.
If you have created previous projects
they will be listed on the left side of the Project Manager dialog box.
The one with the name Project Default will always be listed. Choose the
project name by
clicking on it with the mouse to highlight its name and then click on Open.
Step
4 -
Mount a local Filesystem.
Right click Filesystems in the left
hand window, then left click Mount and
Local Directory in the drop
down boxes that appear.
Step 6 - Navigate to the directory where the files are located.
A file explorer dialog box will appear
in which you
can navigate to the directory in which the Java source file exists.
This dialog box only shows directories, so you must know where your
Java source file is located. Navigate to the directory in which the
file is located. If needed, you may have to use the Windows File
Explorer (
Step 1 above) to find the file. When
you have navigated to the
correct directory, click on
Finish.
Step 6 - Locate the files in the NetBeans
Filesystem tree.
By default the file names are not
displayed n the NetBeans left hand side window. To see the file names,
click on the
symbol to the left of the
Filesystem name.
The files in the filesystem will be displayed.
Step 7. Edit,
compile, and execute the source file.
Return
to How-To Home
Last modified: 13 June 2004