Deploying Java Programs

Preparing a project for deployment

Before you actually deploy your applet or application, there are some preliminary steps you should take to prepare your project so your program will work on another computer when deployed.

Rules for making a deployable application or applet

Rules for deployment

Note: For updated information on deployment, see JBuilder's technical publications web site at http://www.borland.com/jbuilder.

See also:

http://java.sun.com/docs/books/tutorial/TOC.html#APPLETS
Discusses basic applet considerations, including security.

http://java.sun.com/docs/books/tutorial/security1.1/index.html
Discusses general security API's and issues.

http://www.suntest.com/100percent/cpd/doc/cbook/cookbook.html
Discusses general portability and purity issues.


Creating an archive file

Once your applet or application is completed and ready to deploy, you will need a convenient way to compress and bundle the class, image, and audio files into one easily deliverable file. The best way to do this is to create a .zip file, or a .jar (Java ARchive) file, which is a zip file containing all the project files, plus a manifest file and potentially signature files, as defined in the Manifest and Signature specification.

To create an archive file,

  1. Open the project you wish to archive.
  2. Compile your project to create the class files.
  3. Choose Wizards|Deployment Wizard.
  4. Select the files to deploy. Also specify if any of the dependency files should be included in the .jar file.
  5. Choose what kind of archive file to create (.zip or .jar) and where it should be put.
  6. Click the Finish button when you are done.

If you selected .jar as the type of archive file, the Deployment Wizard creates a manifest file called manifest.mf in a meta-inf subdirectory of the .jar file. It also creates a copy of this manifest file named after the project name, and puts it into a meta-inf subdirectory in your project.

About the manifest file

The manifest file for a .jar file contains a list of files present within the archive itself, and includes information about some or all of the classes contained in that .jar file. The manifest file that is generated by the Deployment Wizard,

The manifest file for any .jar must be named manifest.mf and must be in the meta-inf subdirectory of the .jar file. The Deployment Wizard assumes that any file with a .MF extension is a manifest file. If a file with the extension .MF is selected as a file to be deployed and you have selected a .jar as the archive type, the Deployment Wizard assumes that this is the manifest you want to use and will rename it (if necessary) and place in the correct location in the .jar file (meta-inf\manifest.mf).

If you have not specified a manifest file in this manner, the Deployment Wizard will generate a manifest based on the files that you have selected to be deployed. This generated manifest will be named <project file name>.mf and then will be saved in the meta-inf subdirectory immediately under the project file (.jpr). For example, if you have launched the Deployment Wizard on the project c:\JBuilder\myprojects\deploytest\deployer.jpr, the manifest for the .jar would be saved as c:\JBuilder\myprojects\deploytest\meta-inf\deployer.mf.

The Deployment Wizard will not automatically add the manifest file to the project, but you can manually select and add the manifest file to the project.

If you are unfamiliar with manifest files, you should allow the Deployment Wizard to generate a new manifest file and overwrite the old manifest file, each time a deployment archive is created.

See Also:

Manifest and Signature specification
JAR files


The just-in-time compiler

AppAccelerator is a just-in-time (JIT) compiler. This add-on compiles Java Virtual Machine codebytes into native operating system codebytes on the fly. AppAccelerator is an operating system add-on for the end-user's computer, to make .class files run faster. AppAccelerator does not produce additional .class files, but rather, processes .class files on the fly. When you issue a compile command, such as Make or Rebuild, the regular compiler produces cross-platform classes that are used for all platforms. Then, with the JIT compiler running on any of the platforms, the class files run faster on that platform. The JIT compiler is currently provided for Windows 95 and Windows NT; other platforms will be supported.

JBuilder uses the JIT by default for the IDE itself and for the target application when run from the IDE. To run the JIT when using command line tools, the user's command-line environment variables must be set.

See Setting environment variables for command-line tools in the JBuilder User's Guide.

See also:
The Deployment Wizard
The Applet Wrapper Wizard