Archive Builder

This is a feature of JBuilder Professional and Enterprise.
Deploying a Java program consists of bundling together the various Java class files, image files, and other files needed by your program, and copying them to a location on a server or client computer where they can be executed. You can deliver the files separately, or you can deliver them in compressed or uncompressed archive files.

JBuilder's Archive Builder assists you in deploying your program. It automatically gathers together classes, resources, and libraries your program needs and deploys the files to a compressed or uncompressed ZIP or JAR file. It also creates the JAR file's manifest.

To open the Archive Builder:

  1. Open the project you wish to deploy.
  2. Compile your project to create the class files.
  3. Choose Wizards|Archive Builder.

Note: The Archive Builder always uses the most recently built class files but does not check to see if they are up to date. If you have made changes to your source, be sure to compile your project again before running the Archive Builder.

See also:
"Deploying programs and applets" in Building Applications with JBuilder
"Step 16: Deploying the Text Editor application to a JAR file" in the tutorial Building a Java text editor.
license.txt in the root directory of your JBuilder installation
deploy.txt in the redist directory of your JBuilder installation


Step 1:

The first step of the Archive Builder lets you select what type of archive you want to create: Applet, Application, Basic, or OpenTool. Depending on your choice here, different defaults will be set and different options available as you work through the steps of the wizard.

Archive Type

Type Description
Applet An applet archive is compressed by default, giving you the advantage of faster applet download time and less space required by your files on target server or system. An applet archive usually includes all required classes from imported libraries, so that the applet is not dependent on external files.
Application An Application archive is not compressed by default. This improves load time. Additionally, uncompressed JAR files zip to smaller files than compressed JAR files. Application archives typically do not include any portions of their libraries, requiring that you provide the necessary redistributable libraries with your installation. The difference between this option and the Basic option is that an Application archive allows you to select your application's main class.
Basic A Basic archive is not compressed by default. This improves load time. Additionally, uncompressed JAR files zip to smaller files than compressed JAR files. Basic archives typically do not include any portions of their libraries, requiring that you provide the necessary redistributable libraries with your installation. You cannot set the main class.
OpenTool An OpenTool archive is not compressed by default. This improves load time. Additionally, uncompressed JAR files zip to smaller files than compressed JAR files. As with Basic and Application archive types, OpenTool archives typically do not include any portions of their libraries, requiring that you provide the necessary redistributable libraries with your installation. An OpenTool archive excepts you to override the manifest file.

Step 2:

Step 2 of the Archive Builder is where you set a name for your archive node and file, select the archive's compression, and choose how frequently the archive is built.

Name

Enter the name of the archive node. The default name is based on the archive type selected in Step 1. It's best to make this name descriptive, particularly since you can have numerous archive nodes per project. This allows you to test various Archive Builder settings to see which most closely match your deployment needs.

The archive node displays in the project pane after you make or build your project. You can right-click the node and make or build it at any time, as well as reset its properties.

Path

Enter the fully qualified path and file name for the archive to be generated by the Archive Builder. You can use the ellipsis button to browse to a different directory location. By default, the archive file is created in the project's root directory.

The Archive Builder supports the ZIP and JAR archive formats. Typically, you will choose a JAR file type. A JAR file (.JAR) is basically a ZIP file with a different extension and with certain rules about internal directory structure. JavaSoft used the PKWARE ZIP file format as the basis for JAR file format. You can change the file type by choosing the ellipsis button and entering another file type in the File Name field.

Note: JAR files are supported only in JDK 1.1, or later, browsers. If you are deploying an applet to a JDK 1.0.2 browser, you need to use a ZIP archive file.

Compression

The Compress The Contents Of The Archive option allows you to choose between a compressed or an uncompressed archive. Usually, you will leave this option off, so the archive is uncompressed. This improves load time. If you plan to create an installer for your program, leave this option off, as uncompressed archives compress smaller than compressed ones.

If your archive is an applet, this option will be selected by default. You should leave it on.

Creating the archive

The Always Create Archive When Building The Project option determines how often your archive file is created. This option is set on, by default, for all archive types. When on, the archive file will be recreated each time you make or rebuild your project.

Note: Once the archive file has been created, you can change its properties by right-clicking the archive node and choosing properties. The next time you make or rebuild, the new property settings will be used.

Step 3:

Step 3 of the Archive Builder is where you choose what parts of the project will be included in the archive. In this step, you can also choose additional classes or files.

Include Required Classes And Known Resources

This option adds any classes that you have specifically added to your archive with the Add Class button. It also adds any classes that use one or more of the added classes.

Note: If you do not add any classes with the Add Classes button, your archive will not contain any classes.

This option also adds known resources. Known resources are those that you specifically add to the archive with the Add File button.

Include Required Classes And All Resources

This option adds any classes that you have specifically added to your archive with the Add Class button. It also adds any classes that use one or more of the added classes.

Note: If you do not add any classes with the Add Classes button, your archive will not contain any classes.

It also adds all resources in the project's source path, such as images, video clips, sound files, etc.

Always Include All Classes And Resources

This option gathers all classes on your project's outpath. The outpath is defined on the Paths page of the Project Properties dialog box. Usually, this is set to the classes directory of your project.

It also gathers all resources on the project's source path, also set on the Paths page of the Properties dialog box. Usually, this is set to the src directory of your project. Resources are files other than class files, such as images, video clips, sound files, etc.

For all archive types, this option is on by default. This option is the safest, as it gathers:

Add Class

The Add Class button displays the Select A Class dialog box, where you select a class to your archive. The class does not have to be in your project's outpath. If you choose either the Include Required Classes And Known Resources or the Include Required Classes And All Resources options, the Archive Builder will scan these added class files for additional class dependencies and will put those classes in the archive.

Add File

The Add File button displays the File Open dialog box, where you choose the file to add to your archive. The file must be in your project's source path. Use this option to add miscellaneous files in your archive, such as resources (.gif, .jpg, and audio files), property files, database drivers, or archived documentation (.html, readme.txt).

Note: The Add File dialog cannot look inside archive files. If a file or package you need is inside an archive file, extract it first to your source folder, then add it using the Add File button.

Remove

Removes the selected class or file from the list.

Step 4:

Step 4 of the Archive Builder is where you determine what to do with library dependencies. The libraries used in your project are listed, and you can choose an individual deployment strategy for each one.

Note: If you deploy any classes from the JDataStore package (com.borland.datastore) or the VisiBroker package (com.visigenic), you will see a warning reminding you that deploying these packages requires a separate deployment license. If you already have the appropriate license and don't want to see this warning again in this project, check "Don't warn me about this project again."

Never Include Any Classes Or Resources

This is the default option for all archive types except applets. No libraries are included in your archive file. You need to distribute the redistributable libraries with your JAR file and include them on the CLASSPATH at runtime, rather than putting the required classes from those libraries inside the JAR file. This is the easiest way to deploy and creates the smallest program JAR file.

If you choose this option, Exclude All is displayed next to the selected library.

Include Required Classes And Known Resources

If you choose this option, the Archive Builder attempts to determine which classes and resources are needed. It will attempt to include any classes that are dependent on classes used in your project. It will also attempt to include any resources that are used by any classes in your project. Note that this process will not work for many libraries.

If you choose this option, Include Deps is displayed next to the selected library.

Include Required Classes And All Resources

If you choose this option, the Archive Builder attempts to determine which classes are needed by classes your project. It attempts to include any classes that are dependent on classes used in your project.

It will also gather all resources on the project's source path, set on the Paths page of the Project Properties dialog box. Usually, this is set to the src directory of your project. Resources are files other than class files, such as images, video clips, sound files, etc. This option is useful if you are deploying third-party libraries.

This option is the default option for the Applet archive type.

If you choose this option, Deps > Resources is displayed next to the selected library.

Always Include All Classes And Resources

This option gathers all classes and resources, whether they are dependent on not. Everything, including libraries used by JBuilder's designers, is copied to your archive file. This option is the safest, but will result in a very large archive file.

If you choose this option, Include All is displayed next to the selected library.

Step 5:

On Step 5 of the Archive Builder, you choose how the manifest file is created. For most users, the default option, Create A Manifest, will be sufficient.

Include A Manifest File In The Archive

This option is on by default. It automatically creates a manifest file in your archive.

Create A Manifest

This option is selected by default for all archive types except OpenTool. If you select JAR as the type of archive file, the Archive Builder automatically generates a manifest file called manifest.mf in a meta-inf subdirectory of the JAR file. The manifest contains a Manifest-Version: 1.0 and Main-Class: header.

Create A Manifest And Save A Copy In The Specified File

This option creates a manifest file and a copy. It places the copy in the file selected in the path field. If the file does not exist, the Archive Builder will create it.

Override The Manifest with The Specified File

This option is for advanced users who want to provide optional information to the JAR tool about a class in the archive. This is the default option for the OpenTool archive type.

If you use this option, the manifest file must exist before you run your program. If not, you'll see the following message in the Compiler tab when you choose Run:

<path name <file_name> (The system cannot find the specified file)

Warning: Only advanced users should select this option.

Step 6:

Step 6 of the Archive Builder is only displayed if you choose Application as the archive type. This step allows you to determine how the application's main class should be determined. The main class runs the application. It contains the public static void main(String[] args) method.

Use The Main Class Specified In The Default Runtime

To use the main class specified on the Run page of the Project Properties dialog box, select this option. This is the default.

Use The Class Specified Below

Enter the class to use as the main class in the Class field. Click the ellipsis button to browse to the class.