Java Reference
In-Depth Information
Therefore, any third-party JARs that you may need for your project should
be mounted.
To mount a local directory as a filesystem, right-click on the little icon la-
beled
Filesystems
in the
Explorer [Filesystems]
window. Choose
Mount
, then
Local Directory
, and you'll get a filechooser to let you navigate your file
structure and choose a directory to mount.
IMPORTANT
To ensure that NetBeans knows how to compile your source, you need to mount
the directory that contains the base level of your source as a mountpoint, not
just have that directory somewhere in a tree of directories.
For example, let's say that your source is kept in two packages,
com.coolco.projecta
and
com.coolco.util
which implies that you
have a directory structure with those names. Let's further assume that you keep
them in a directory called
src
which is itself contained in a directory called
brolly
, as shown in Figure 10.3.
The likely thing to do is to mount the
brolly
directory, since it will contain
the source and all sorts of other project-related directories. That's fine, as far
as it goes. But since the mountpoints in NetBeans are also the
CLASSPATH
directories, you need to also mount
brolly/src
, so that directories like
com/coolco/util
are found when your Java sources have statements such
as
import com.coolco.util.*;
.
It's OK to have the same directory show up in different mountpoints. Net-
Beans won't get confused, although you may. You'll probably want to edit and
compile from the mountpoint of, in this example,
brolly/src
. The
src
folder
inside the
brolly
mountpoint would refer to the same files. Just keep the one
always open and the other closed, and you should be able to keep them straight.
10.2.3.1
The
Explorer
window has tabs at the bottom which let you look at different
aspects of your work. In some instances you'll want the
Project
view. For this,
you have to mount file's from the already mounted filesystems in the
Filesys-
tem
view. Seems redundant, no? The
Project
view lets you set properties for
the project as a whole or for individual files in the project. These settings apply
to that file only for the project. Another project, looking at the same files, might
have different settings.
For now, don't worry about the difference. Many people like to work in
the
Filesystem
view and never bother with projects. Others, especially those
working on multiple products or projects, like
Projects
as a way to switch
Filesystem versus Project