Maryland in Europe Logo



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.

 File Explorer

Step 2 - Start NetBeans if you have not already done so.

Double click the desktop icon NetBeans 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
Start Netbeans

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.
 
Click on New

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.

Filesystems-mount-local

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 Plus symbol symbol to the left of the Filesystem name.

Click on +

The files in the filesystem will be displayed.

Files in Filesystem

Step 7.  Edit, compile, and execute the source file.
More information can be found in Edit, compile, and execute the source file.

Return to How-To Home

Last modified: 13 June 2004