.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.
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.
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
PRO: Recognized automatically
in JBuilder Professional
ENT:
Recognized automatically in JBuilder Enterprise
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.
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.
Step 1 sets your project name, type, and template, root directory, source, backup, and output directories.
.jpx
or .jpr
.
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.
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.
"Setting paths for required libraries"
"Working with libraries"
If you don't want a project notes file, uncheck this box and click Finish.
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.
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.
"Working with multiple projects"
"The JBuilder environment"
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.
To save a project, select File|Save All, File|Save Project, or click the Save All button on the main toolbar.
To close a project, select File|Close Projects or click the Close Project button on the project toolbar.
"Packages"
"How JBuilder constructs paths"
"Where are my files?"
To open a project using the File|Open Project command,
To open a previously opened project with the File|Reopen command,
To open a file in the content pane, you may do one of three things:
To view a project in a new AppBrowser,
To create a new Java source file using 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,
.java
file type from the drop down list or include the extension when you type the name.
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.
See also:
Building Applications with JBuilder: The JBuilder environment
For larger projects, you can use project folders to organize your project hierarchically.
Adding folders
To add a project folder to a project,
To add a file to a folder,
Adding files and packages
To add an existing file or package to a project,
To remove any of these from a project,
You can also select multiple files and remove them from the project.
To open a file without adding it to a project,
To rename an open file,
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.
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).
"How JBuilder constructs paths"
Library configurations are saved in .library
files and can be saved to several locations:
.library
file to the .jbuilder
directory in the user's home directory.
.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.
.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.
.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.
Once you've created the library, add it to JBuilder as follows:
To add the library to a project, see "Setting paths for required libraries."
You can also add libraries in the Project Properties dialog box.
"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?"
There are three possible colors for libraries listed in JBuilder dialog boxes:
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. |
To set project properties,
.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.
On the Paths page, you can set the JDK version, various paths for the project, and the Required Libraries Paths.
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."
You can edit the current JDK version as follows:
JBuilder Professional and Enterprise support JDK switching. You can also add, edit, and delete JDKs. To switch to another JDK, follow these steps:
If it's not listed, select New to open the New JDK wizard.
.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.
.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.
.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.
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.
You can select libraries in the Required Libraries list on the Paths page and edit, delete, or change their order in the library list.
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.
"Working with libraries"
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.
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.
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.
The .java file location for Lion.java
is:
/home/username/jbproject/SampleProject/src/feline/africa/Lion.java
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
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.
fourwordpackagename
not FourWordPackageName
)
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
.
In the construction of paths, JBuilder eliminates duplicate path names. For Windows, this prevents potential problems with DOS limits.
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
.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
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
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
The Doc Path can be set on the Paths page of the Project Properties dialog box. Paths are searched in the order listed.
/home/username/jbproject/[project name]/bakJSP 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,
/home/username/jbproject/project_name
.jpr
file. JBuilder uses the Source Path, Class Path, Browse Path, and Output Path to find and save files.
.class
files created by JBuilder when you compile your project.
"How JBuilder constructs paths"
"Working with libraries"
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.
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.