Creating and managing projects

To develop programs in the JBuilder environment, you must first create a project to work in. A JBuilder project uses a project file to organize the files and maintain the settings and project properties. JBuilder uses a .jpr or .jpx extension on project files. The .jpr file type is useful for general purposes. The .jpx type of project file is also suitable for use in a team development environment and version control. You can change the type of a project file by right-clicking the project file in the project pane and choosing Rename "[project file name]" from the pop-up menu.

Files in a project can be in any folder; the project is an organizational tool rather than a repository. Restructuring a project tree has no effect on your directory tree.

The project file contains a list of files in the project and the project properties, which include a project template, default paths, class libraries, and connection configurations. JBuilder uses this information when you load, save, build, or run a project. Project files are modified whenever you use the JBuilder development environment to add or remove files or set or change project properties. You can see the project file as a node in the project pane. Listed below it are all the files in the project.

Note: If automatic source packaging is enabled, source package nodes also appear in the project pane. These display files and packages that are on the project's source path. See "Automatic source packages." This is a feature of JBuilder Professional and Enterprise.

While you can include any type of file in a JBuilder project, there are certain types of files that JBuilder automatically recognizes and for which it has appropriate views. You can customize file type handling and see the icons associated with many file types by selecting Tools|IDE Options and choosing the File Types tab.

Common file types in a JBuilder project

File types Description JBuilder Edition
.jpr JBuilder project file. ALL
.jpx JBuilder project file that is formatted as an XML file. ALL
.java Java source file. ALL
.class Compiled class file. There is one for each class in a .java source file. ALL
.c C source file. ALL
.h C header file. ALL
.cpp C++ source file. ALL
.hpp C++ header file. ALL
.gif Graphics file. Good for few-color images. ALL
.jpg, .jpeg, .jpe Graphics file. Good for photos and tonal images. ALL
.bmp Graphics file. A Windows bitmap format. ALL
.png PNG Graphics file. Good for photos and tonal images. ALL
.html, .htm HTML document. ALL
.shtml Embedded server-side HTML document. PRO, ENT
.asp Microsoft Active Server Pages. ALL
.txt Text file. ALL
.bat Batch file. ALL
.jar, .zip Archive files: Java archive file, Zipped archive file PRO, ENT
.war, .ear Archive files: Web archive file, Enterprise archive file ENT
.properties Properties file. ALL
.sql Structured query language file PRO, ENT
.sqlj Structured query language J file ENT
.schema Schema file. PRO, ENT
.ejbgrp EJB group file. ENT
.wml Wireless markup language file. ENT
.jds JDataStore file. PRO, ENT
.idl Interface definition language file. ENT
.schema Schema file. ENT
.dll Dynamic link library file. ENT
.jsp JavaServer Page file. PRO, ENT
.tld JSP Tag library descriptor file. ENT
.xml, .xsl Extensible markup language file, Extensible style sheet language file ENT

ALL: Recognized automatically in JBuilder Foundation, Professional, and Enterprise
PRORecognized automatically in JBuilder Professional
ENT: Recognized automatically in JBuilder Enterprise


Creating a new project

To start a new project, use JBuilder's Project wizard to generate the basic framework of files, directories, paths, and preferences automatically. The Project wizard can create a project notes file that can be inserted as a comment block in the files created from within the project and consequently included in JavaDoc-generated documentation. These comments can be modified on the General page of the Project Properties.

If you use the Application wizard or the Applet wizard without a project open, the Project wizard is launched first so that you can create a new project to hold the new application or applet.

Creating a new project with the Project wizard

To create a new project with the Project wizard, select File|New Project. You may also choose File|New, select the New tab, and double-click the Project icon. The Project wizard appears.

Project wizard: Step 1

Project wizard: Step 1

Step 1 sets your project name, type, and template, root directory, source, backup, and output directories.

Note: Only advanced users should change these suggested paths.

  1. Enter your project name and the directory where it will reside. You may use an existing directory or create a new one by entering it here. If you enter a path that is syntactically flawed, you can't proceed.

    Note: JBuilder uses the project name as the default package name.

  2. Select the type of project: .jpx or .jpr.

  3. The Directory Is Parent To Source And Output Directories option is on by default. If you want to set different parent directories, uncheck it.

  4. Use the Project For Defaults field to select your project template. To choose the default or a project you've opened previously as a template, click the down arrow and choose from the list. If you want to use another project, click the ellipsis button to open the Open Project dialog box.

  5. Select or enter your root path in the Root Path field.

  6. JBuilder automatically creates a directory for the project that has the same name as the project. If you want to use a different directory name, type it into the Project Directory Name field.

  7. The directories default to the names used in the project template. Usually this is src for the Source Directory, bak for the Backup Directory, and classes for the Output Directory. If you want to change this, type in your preferences.

  8. Click Next to go to Step 2.

Project wizard: Step 2

Step 2 lets you check your paths, set the JDK version you'll compile with, and select the required class libraries. You can also decide if you want a project notes file, which will provide the information for your application's Help|About dialog box. If you don't want to create a project notes file, you can fill in the other fields, uncheck this box, and click Finish in Step 2.

Project wizard: Step 2

  1. Check your project, source, backup, and output paths. Note that the paths set in Step 1 are used here.

  2. Select the version of the JDK that you want to compile with. See "Setting the JDK."

  3. Click the Add button in the Required Libraries area to add a library. The Select One Or More Libraries dialog box allows you to create new libraries and edit or delete existing ones. To select multiple libraries, select a library, hold down Ctrl (to add an individual library) or Shift (to add a list of contiguous libraries), then click an additional library.

  4. Click OK when the list is complete.

    See also:
    "Setting paths for required libraries"
    "Working with libraries"

  5. Note that the Make Project Notes File option is checked by default. This file contains the information you enter in the next step of the wizard.

    If you don't want a project notes file, uncheck this box and click Finish.

  6. Click Next to go to Step 3.

Project wizard: Step 3

Step 3 develops the information for you application's Help|About dialog box. This information can also be inserted as a comment-block to new wizard-generated files created for your project. This information can be changed on the General page of the Project Properties (Project|Project Properties).

Fill in the title of the project, author, and company, and add your product description. Click Finish. Your new project file appears at the top of the project pane with the HTML project notes file below it. Double-click the HTML file to see the project notes in the content pane.


Displaying project files

JBuilder displays each open file of a project in the content pane of the AppBrowser. Double-click a file in the project pane to open it in the content pane. A tab with the file name appears at the top of the content pane.

The following figure shows a project file, Welcome.jpr, in the project pane with the source files listed below it. This project contains a package and three source files. Two files are open in the content pane with the selected file, WelcomeApp.java, showing in the source pane.

Right-click the project file to display a menu with such menu selections as Open, Add To Project, Remove From Project, Close Project, Make, Rebuild, and Properties. Many of these menu selections are also available from the Project menu.

See also:
"Working with multiple projects"
"The JBuilder environment"


Saving projects

When you are working on a project, you can save it to the suggested location or to a directory of your choice. By default, JBuilder saves projects to the jbproject directory of your home directory, although this depends on how the administrator has set up your system. Each project is saved to its own directory within jbproject. Each project directory includes a project file (.jpr or .jpx), an optional .html file for project notes, a classes subdirectory for class files (.class), a src subdirectory for source files, and a bak subdirectory for backup files.

Saving and closing projects

To save a project, select File|Save All, File|Save Project, or click the Save All button Save All  on the main toolbar.

To close a project, select File|Close Projects or click the Close Project button Close Project on the project toolbar.

See also:
"Packages"
"How JBuilder constructs paths"
"Where are my files?"


Opening an existing project

There are two ways to open an existing project. You can either use the File|Open Project command or the File|Reopen command.

To open a project using the File|Open Project command,

  1. Choose File|Open Project. The Open File dialog box appears.
  2. Navigate to the directory that contains the project file you want to open.
  3. Select the project file and click OK or press Enter. You can also double-click the project file to open it.

To open a previously opened project with the File|Reopen command,

  1. Choose File|Reopen.
  2. Choose the project you want to open from the list of previously opened projects.
    The project file and its source files will appear in the project pane.

To open a file in the content pane, you may do one of three things:

To view a project in a new AppBrowser,

  1. Select Window|New Browser.
  2. Select File|Open Project and navigate to the file in the Open Project dialog box.
Note: All open projects are available in all AppBrowsers from the Project drop-down list.


Creating a new Java source file

There are several ways to create Java source files. You can create a file using the Class wizard to generate the framework of your file or by selecting File|Open File.

To create a new Java source file using the Class wizard,

  1. Create a new project as described in "Creating a new project."
  2. Choose File|New Class.
  3. Enter the class name in the Class wizard.

The .java file is created and added to your project (its node appears in the project pane). The file opens in the content pane in editor.

To create a new Java source file using File|Open File,

  1. Select File|Open File to open the Open File dialog box.
  2. Type the name of the file.
  3. Choose the .java file type from the drop down list or include the extension when you type the name.
  4. Click OK or press Enter.
  5. Click OK at the File Does Not Exist prompt.
  6. JBuilder creates the new file and opens it in the content pane.

After you edit a file, save it by choosing File|Save or clicking the Save File icon . The path and parent directory of the file appears at the top of the AppBrowser window when the file is selected and open.


Managing projects

Use the AppBrowser to perform project management tasks such as:

See also:
Building Applications with JBuilder: The JBuilder environment

Adding to a project

In the AppBrowser, you can add folders, new files, and existing files to your project. Many of these commands are available from the project pane's right-click menu as well as the main menu.

For larger projects, you can use project folders to organize your project hierarchically.

Note: Project folders are for organizational purposes only and do not correspond to directories on disk.

Adding folders

To add a project folder to a project,

  1. Select the project in the project pane.
  2. Choose File|New Folder from the main menu or right-click in the project pane and select New Folder. (To nest folders, select the existing folder you want to add a new folder to before selecting File|New Folder.)
  3. Type the name of the folder and click OK.

To add a file to a folder,

  1. Either right-click the folder and choose Add Files/Packages to open the Add To Project dialog box, or select the folder and click the Add Files/Packages button Add To Project on the project pane toolbar.
  2. Navigate on the Explorer page of the Add Files To Project dialog box to the directory that contains the file you want to add.
  3. Select the file and click Open.

Adding files and packages

To add an existing file or package to a project,

  1. Either right-click the folder and choose Add Files/Packages to open the Add To Project dialog box, or select the file and click the Add Files/Packages button  on the project pane toolbar.
  2. Select the Explorer or Packages page of the Add Files Or Packages To Project dialog box.
  3. Navigate to the directory that contains the file or package you want to import, select the file, and choose OK. The file node appears below the project in the project pane.

    Note: You can also add new files by entering the new file name and the extension in the Add To Project dialog box.

Removing from a project

You can also remove unwanted folders, files, classes, and packages from your project.

To remove any of these from a project,

  1. Right-click the folder or file and choose Remove From Project. Or select it and click the Remove From Project button .
  2. Click OK in the Remove From Project prompt.

    Note: If a folder contains files, they are also removed from the project.

You can also select multiple files and remove them from the project.

Deleting from a project

You can also delete unwanted files, classes, and packages from the disk by right-clicking a file and choosing Delete.

Caution: This permanently deletes the files from the project and the computer's hard disk.

Opening a file outside of a project

Occasionally you might want to open a file, but you don't want to add it to a project. You can use the File|Open command.

To open a file without adding it to a project,

  1. Choose File|Open File to open the Open File dialog box.
  2. Select the file you want to open.
  3. Click OK. The file contents are displayed in the AppBrowser.

Renaming projects and files

There are several ways to rename a project or one of its files.
  1. Select the project or file in the project pane.
  2. Select Project|Rename, File|Rename, or right-click in the project pane and select Rename.
  3. Enter the new name in the Rename dialog box.
  4. Click Save.

To rename an open file,

  1. Right-click the file tab at the top of the content pane.
  2. Select Rename.
  3. Enter the new name in the Rename dialog box.
  4. Click Save.

Caution: Renaming projects and files does not change the package and file names referenced inside the code.


Working with multiple projects

You can work on multiple projects simultaneously in the JBuilder development environment. You can open them in one AppBrowser or in different AppBrowsers. All open projects are available from any open AppBrowser from the Project drop-down list. Any changes made in one AppBrowser are also made in the other open AppBrowsers. Open a new JBuilder AppBrowser by selecting Window|New Browser.

Switching between projects

If several projects are open in the AppBrowser, only one project is visible in the project pane. Switch to another open project by selecting the project from the Project drop-down list on the toolbar above the project pane. Open files are also available from the Window menu.

To switch between open projects in different AppBrowsers, select the AppBrowser from the Window menu. Open files are also available from this menu. In the following example, two AppBrowsers are open. Next, the two open project files are listed, followed by one open .java file.

Saving multiple projects

To save changes to all open files and projects, choose File|Save All. All files in all open AppBrowsers are saved.


Working with libraries

What is a library?

JBuilder uses libraries to find everything it needs to run a project as well as for browsing through source, viewing JavaDoc, using the visual designer, applying CodeInsight, and compiling code. Libraries are collections of paths that include classes, source files, and documentation files. Individual library paths are often contained in JAR or ZIP files but can also be contained in directories.

When libraries are added to JBuilder, they are added to the class path so JBuilder can find them. Libraries are searched in the order listed. The order of libraries can be changed in the Configure Libraries dialog box (Tools|Configure Libraries) and on the Paths page of the Project Properties dialog box (Project|Project Properties).

See also:
"How JBuilder constructs paths"

Library configurations are saved in .library files and can be saved to several locations:

User Home
Saves the .library file to the .jbuilder directory in the user's home directory.
JBuilder
Saves the .library file to the jbuilder/lib directory. Multiple users who are using JBuilder on a network or sharing JBuilder on a single machine have access to the libraries in this folder.
Project
Saves the .library file in the current project's directory. This is a feature of JBuilder Professional and Enterprise. When using the version control feature in Enterprise, the .library file is checked in with the other project files.
User-defined folder
Saves the .library file to a user-defined folder or shared directory. You must add the new folder in the Configure Libraries dialog box before it can appear in the drop-down list. This is a feature of JBuilder Enterprise.

Adding and configuring libraries

There are several ways to add new libraries to your project. First, you may want to gather your files into JAR files, especially if you plan to deploy your program.

Once you've created the library, add it to JBuilder as follows:

  1. Select Tools|Configure Libraries.
  2. Click the New button to open the New Library wizard.

  3. Enter a name for the new library in the Name field.
  4. Select a location from the drop-down list to save the library configurations: Project, User Home, JBuilder, or user-defined folder. Project folders are a feature of JBuilder Professional and Enterprise. User-defined folders are a feature of Enterprise.
  5. Click the Add button and select one or more paths containing class, source, and documentation files. JBuilder automatically determines the correct path for the files. Click OK. Notice that the selection appears in the Library Paths list.
  6. Click OK to close the New Library wizard. Note that the library is saved to the appropriate class, source, and documentation paths in the Configure Libraries dialog box. You can also add, edit, remove, and reorder the library lists in this dialog box. JBuilder Enterprise also includes an Add Folder feature.

  7. Click OK to close the Configure Libraries dialog box.

To add the library to a project, see "Setting paths for required libraries."

You can also add libraries in the Project Properties dialog box.

  1. Select Project|Project Properties.
  2. Select the Required Libraries tab on the Paths page and click the Add button.
  3. Click the New button to open the New Library wizard.

See also:
"Setting paths for required libraries"
"Using JAR Files: The Basics" at http://java.sun.com/docs/books/tutorial/jar/basics/index.html
"New Library wizard"
"How JBuilder constructs paths"
"Where are my files?"

Editing libraries

In some cases, you may need to edit a library. Perhaps you don't need all the classes the library contains. To edit an existing library,
  1. Select Tools|Configure Libraries.
  2. Select the library you want to edit from the list of libraries.
  3. Select the Class, Source, or Documentation tab to choose the library you want to edit.
  4. Select the library and click Edit.
  5. Browse to a file or user-defined folder in the Select Directory dialog box. Click OK.
  6. Click Add to browse to a library to add.
  7. Select a library and click Remove to remove it.
  8. Reorder libraries by selecting a library and clicking Move Up or Move Down.

    Tip: Remember, JBuilder searches libraries in the order listed.

  9. Click OK to close the Configure Libraries dialog box.

Display of library lists

There are three possible colors for libraries listed in JBuilder dialog boxes:

The color use is explained in the following table.

Colors in library lists

Color Description Troubleshooting
Black The library is defined correctly.  
Red The library definition is missing. This typically means the project refers to a library that is not yet defined. It can also mean the library has been defined without any paths.
Gray Use of this library requires an upgrade. You need to upgrade your edition of JBuilder in order to use this library. For example, if you have JBuilder Foundation, use of the dbSwing library requires that you upgrade to either JBuilder Professional or Enterprise.


Setting project properties

Project properties control how the project is compiled. In the Project Properties dialog box (Project|Project Properties), you can set such options as:

To set project properties,

  1. Right-click the .jpr or .jpx file name in the project pane and choose Properties to display the Project Properties dialog box. Or, select the project and choose Project|Project Properties. The Project Properties dialog box appears.
  2. Select the appropriate tab for the options you want to set. In this image the Paths page is selected.

    On the Paths page, you can set the JDK version, various paths for the project, and the Required Libraries Paths.

Setting the JDK

JBuilder Professional and Enterprise fully support JDK switching, while JBuilder Foundation allows you to edit a single JDK. JBuilder can compile and run against all Sun JDKs and many others.

With JBuilder Professional and Enterprise, you can set the JDK version for your project on the Paths page of the Project Properties dialog box as well as add, edit, and remove JDKs in the Configure JDKs dialog box. See "Setting the JDK in Professional and Enterprise."

For JBuilder Foundation, you can edit the JDK in the Configure JDKs dialog box (Tools|Configure JDKs). See "Editing the JDK."

Editing the JDK

You can edit the current JDK version as follows:

  1. Select Tools|Configure JDKs to open the Configure JDKs dialog box.
  2. Click the ellipsis button to the right of the JDK Home Path field and browse to the desired JDK in the Select Directory dialog box.

    Setting the JDK

  3. Click OK and note the revised JDK name and home path in the Configure JDKs dialog box.
  4. Click OK to close the dialog box.

Setting the JDK in Professional and Enterprise

JBuilder Professional and Enterprise support JDK switching. You can also add, edit, and delete JDKs. To switch to another JDK, follow these steps:

  1. Select Project|Project Properties and select the Paths tab.
  2. Click the ellipsis button to the right of the JDK version. The Select A JDK dialog box appears:

  3. Select the JDK in the Select A JDK dialog box if it's listed and press OK.

    If it's not listed, select New to open the New JDK wizard.

    New JDK wizard

    1. Click the ellipsis button and browse to the home directory of the JDK you want to add to the list. Click OK. Note that the JDK Name field is filled in automatically.
    2. Select the location to store the JDK specifications:
      • User Home: saves the JDK specifications in a .library file in the .jbuilder directory of the user's home directory. Save to this location if you want the JDK available to all projects.
      • JBuilder: saves the JDK specifications in a .library file in the jbuilder directory. Multiple users who are using JBuilder on a network or sharing JBuilder on a single machine have access to the JDKs in this folder. This is a feature of JBuilder Professional and Enterprise.
      • Project: saves the JDK specifications in a .library file in the current project's directory. Save to this location if you only want the JDK available to this project. This is a feature of JBuilder Professional and Enterprise.
      • User-defined folder: saves the JDK specifications to an existing user-defined folder or shared directory. You must add the new folder (select Tools|Configure JDK and click Add Folder) before it can appear in the drop-down list. This is a feature of JBuilder Enterprise.
    3. Click OK. Note that the JDK specification has been added to the specified directory in the Select A JDK dialog box.

  4. Click OK to close the Select A JDK dialog box. Note that the JDK path is updated to the new selection.
  5. Click OK to close the Project Properties dialog box.
  6. Save the project. The JDK version is updated in the project file.

Tip: You can add, edit, and delete JDKs by selecting Tools|Configure JDKs. You can also modify the Default Project Properties (Project|Default Project Properties) to change the JDK for all future projects.

Configuring JDKs

Adding and deleting JDKs are features of JBuilder Professional and Enterprise.
You can add, edit, and delete JDKs in the Configure JDKs dialog box (Tools|Configure JDKs). Foundation users can edit JDKs as explained in "Editing the JDK."

In this dialog box, you can:

For more information, select the Help button on the Configure JDKs dialog box and the New JDK wizard.

Setting paths for required libraries

On the Paths page of the Project Properties dialog box, you can set the libraries to use when compiling. JBuilder places any selected libraries on the classpath. To add, edit, remove, and reorder libraries, select the Required Libraries tab.

You can select libraries in the Required Libraries list on the Paths page and edit, delete, or change their order in the library list.

Note: Libraries are searched in the order listed. To switch the order of libraries, select a library, then click Move Up or Move Down.

The Add button displays the Select One Or More Libraries dialog box, where you choose the libraries to add to your project. Select New in this dialog box to open the New Library wizard and create a new library.

You can also configure libraries by selecting Tools|Configure Libraries.

See also:
"Working with libraries"


Packages

Java groups .java and .class files in a package. All the files that make up the source for a Java package are in one subdirectory (src); all compiled files are in another subdirectory (classes). A package is much like a library of source files (.java files) and classes (.class files). When building applications, JBuilder extracts the name of the package from the name of the project file, and suggests it in the Application or Applet wizard. For instance, the first default project name is Untitled1.jpr, so the Application or Applet wizard would suggest using a package name of Untitled1. Future suggested package names will always be the last previously entered.

Let's look at a sample project to see how the package name affects the file structure.

Note: In these examples, paths reflect the UNIX platform. See "Documentation conventions."

To organize your project, you might have your project in a folder called SampleProject. This project folder contains a project file (feline.africa.jpr), a classes directory and a src directory:

In creating this project, you'll want to create your own packages to hold related sources and classes. In this example, feline.africa.jpr contains a package name of feline.africa. This package contains felines only from Africa: Lions, Tigers and Leopards.

The class files, which are saved in a directory structure that matches the package name, are saved in the classes subdirectory within the project. The src subdirectory, which contains the .java files, has the same structure as the class subdirectory.

If the individual classes contained in this project are Lion.class, Tiger.class, and Leopard.class, these would be found in classes/feline/africa. The source files, Lion.java, Tiger.java, and Leopard.java, would be in found in src/feline/africa as shown here.

.java file location = Source Path + Package Path

It's important to understand what pieces of information JBuilder uses to build the directory location for any given .java file. The first part of the directory path is determined by the Source Path. The Source path is defined at the project level and can be modified on the Paths page of the Project Properties dialog box.

Continuing with the SampleProject example, the Source Path for Lion.java is:

/home/username/jbproject/SampleProject/src

The second part of the directory path is determined by the package name, which in this case is feline.africa.

Note: The Java nomenclature uses period (.) to separate the parts of a package.

The .java file location for Lion.java is:

/home/username/jbproject/SampleProject/src/feline/africa/Lion.java

For more information on the Source Path, see "How JBuilder constructs paths."

.class file location = Out Path + Package Path

The directory location for the .class file is determined by the Out Path and the package name. The Out Path is the "root" to which JBuilder will add package paths to create the directory structure for the .class files generated by the compiler. The Out Path is defined at the project level and can be modified on the Paths page of the Project Properties dialog box.

In the SampleProject example, the Out Path for Lion.class is:

/home/username/jbproject/SampleProject/classes

The second part of the directory path is determined by the package name, which in this case is feline.africa.

As shown below, the .class location for Lion.class is:

/home/username/jbproject/SampleProject/classes/feline/africa/Lion.class

For more information on the Out Path, see "How JBuilder constructs paths."

Using packages in JBuilder

When referencing classes from a package, you can use an import statement for convenience. An import statement allows you to omit the package name when you reference a particular class in your code. (JBuilder's designers and wizards add import statements automatically.) Here's an example of an import statement:
import feline.africa.*;

If this import statement were included in your source code, you could refer to the Lion class as just Lion. If you don't import a package, you must reference a particular class in your code with its fully qualified class name. As shown in the following diagram, the fully qualified class name for Lion.java is feline.africa.Lion. (package name + class name without the extension)

For more information about packages and the Java language, refer to one of the many excellent third-party sources.

Package naming guidelines

The following package naming guidelines are recommended for use in all Java programs. To encourage consistency in readability and maintainability, package names should be

If your packages will be shared outside your group, package names should start with an Internet domain name, only reversed. For example, if you were using the domain name myDomain.com, your package names should be prefixed with com.mydomain.


How JBuilder constructs paths

The JBuilder IDE uses several paths during processing: Paths are set at a project level. To set paths, use the Project Properties dialog box. See "Setting project properties" for more information.

In the construction of paths, JBuilder eliminates duplicate path names. For Windows, this prevents potential problems with DOS limits.

Note: In these examples, paths reflect the UNIX platform. See "Documentation conventions."

Source Path

The Source Path controls where the compiler looks for source files. The Source Path is constructed from both of the following:

The complete Source Path, then, is composed of these two elements in this order:
Source Path + Output Path/Generated Source

Using the SampleProject as an example, the Source Path for the feline.africa.jpr project is:

/home/username/jbproject/SampleProject/src

Output Path

The Output Path contains the .class files created by JBuilder. The Output Path is constructed from the path defined in the Outputput Path text box, located on the Paths page of the Project Properties dialog box.

Files are placed in a directory whose path matches the Output Path + the package name. There is only one Output Path per project.

For example, in the SampleProject example, the Output Path for the feline.africa.jpr project is:
/home/username/jbproject/SampleProject/classes

Class Path

The Class Path is used during compiling. This path is constructed from all of the following:

The complete Class Path, then, is composed of these elements in this order:
Output Path + Library class paths (in the order libraries are listed in the Project Properties dialog box) + Target JDK version

For example, the complete Class Path for Lion.class is:

/home/username/jbproject/SampleProject/classes:
/user/jbuilder/lib/dbswing3.1.jar:/user/jdk1.3/bin

Browse Path

The Browse Path is used by the IDE when you

The Browse Path is constructed from all of the following:

The complete Browse Path, then, is composed of these elements in this order:
Source Path + Library source paths (in the order libraries are listed on the Paths page of the Project Properties dialog box) + JDK target version source path

For example, the complete Browse Path for Lion.class is:

/home/username/jbproject/SampleProject/src:
/user/jbuilder/lib/dbswing3.1.jar:
/user/jbuilder/lib/dx3.1.jar:/user/jdk1.3/bin

Doc Path

The Doc Path is the path or paths that contain the HTML documentation files for the JDK selected in the JDK box. This allows reference documentation to be displayed in the doc pane.

The Doc Path can be set on the Paths page of the Project Properties dialog box. Paths are searched in the order listed.

Backup Path

JBuilder uses the Backup Path to store backup versions of source files. The default backup directory is:
/home/username/jbproject/[project name]/bak
JSP files, HTML files, and some other text files are not treated as source files. These files are backed up in their original directories.

You can include these backups in the backup directory of your project instead. To do so,

  1. Select Project|Project Properties and look at the Paths page.
  2. Select the Source page inside the Paths page.
  3. Click Add in the Source page. This brings up the Select One Or More Directories dialog box.
  4. Browse to the project backup directory, select it, and click OK.

Working Directory

JBuilder uses the working directory to save the project files. The default working directory is:
/home/username/jbproject/project_name


Where are my files?

Each file in a project is stored with a relative path to the location of the .jpr file. JBuilder uses the Source Path, Class Path, Browse Path, and Output Path to find and save files.

See also:
"How JBuilder constructs paths"
"Working with libraries"

How JBuilder finds files when you "drill down"

When you drill down to explore source code, JBuilder searches for the .java files using the Browse Path. For more information about drilling down, see "Navigating in the source code" in Building Applications with JBuilder.

How JBuilder finds files when you compile

When you compile your project, JBuilder uses the following paths:

JBuilder looks in the Class Path to find the location of the .class files, the libraries to use, and the target JDK version to compile against. The compiler compares the .class files with their source files, located in the Source Path, and determines if the .class files need to be recompiled to bring them up to date. The resulting .class files are placed in the specified Output Path.

For information about compiling files, see the "Compiling Java programs" chapter.

How JBuilder finds class files when you run or debug

When you run and debug your program, JBuilder uses the Class Path to locate all classes your program uses.

When you step through code with the debugger, JBuilder uses the Browse Path to find source files.

For information about debugging files, see the "Debugging Java programs" chapter.