SQL/MX Programming Manual for Java

Program and Module Management
HP NonStop SQL/MX Programming Manual for Java523726-003
6-6
Guidelines for Generating a JAR File
Guidelines for Generating a JAR File
Follow these guidelines for packaging an SQLJ application in a JAR file:
Listing Profiles in a Manifest File on page 6-6
Verifying the Program Files on page 6-6
Running the jar Tool on page 6-6
Listing Profiles in a Manifest File
For the SQLJ run time and translator program to locate the profiles (.ser files) in a
JAR file, the profiles must be listed in the manifest file of the JAR file. The SQLJ run
time and translator program ignore any profiles that you do not list in the manifest file.
The manifest file, which the jar tool automatically generates when you create a JAR
file, stores meta-information about the archive and is always the first entry in a JAR file.
By default, the name of the manifest file is META-INF/MANIFEST.MF.
Create your own manifest file (for example, myManifest.mf) and include these
entries for all profiles in the SQLJ application:
Name: name-of-profile
SQLJProfile: TRUE
Separate each profile entry with a space, as example shown:
Name: MyProg_SJProfile0.ser
SQLJProfile: TRUE
Name: MyProg_SJProfile1.ser
SQLJProfile: TRUE
For more information about manifest files, see the jar tool description in the NonStop
Server for Java Tools Reference Pages.
Verifying the Program Files
Within a JAR file, the directory structure mimics the package structure of the class files.
Before running the
jar tool, make sure that the profiles (.ser) are in the same
relative directory as the class files that use the profiles.
Running the jar Tool
To package SQLJ application files in a JAR file, use the jar tool. For more
information, see jar Tool Command Line on page 5-40. For example, this command
combines all the class files (.class) and profiles (.ser) in the current directory into
one JAR file named MyApp.jar and includes important manifest information from the
manifest file that you created:
jar cmf myManifest MyApp.jar *.class *.ser
Caution. To run an SQLJ program, the profiles (.ser files) must be in the same relative
directory as the class files that use the profiles. If these files do not exist in the same location,
the SQLJ run time fails to find the profile, and the program fails to execute.