JDev: Including a Class-Path In Your MANIFEST.MF
By Olaf Heimburger-Oracle on Jan 03, 2008
JAR FileJava Applications can and should be packaged in a Java Archive file (JAR file). This is basically a ZIP file with an additional META-INF directory which contains a file called MANIFEST.MF.
MANIFEST.MFThe MANIFEST.MF file contains a number of entries which I call tags. The most common ones are Manifest-Version, Main-Class, or Class-Path. You'll find Manifest-Version in every MANIFEST.MF file.
Main-ClassThe Main-Class tag is useful for an application packaging with the main class defined, but not telling the user. To start the application you usually issue something like java -jar application.jar. One of the well known examples is java -jar oc4j.jar. To specify the Main-Class tag in your MANIFEST.MF you need to include the following line:
Class-PathThe Class-Path tag is useful for specifying the list of the libraries application needs to successfully run. You can specify the class path like any other but use the blank character (' ') as the path separator. Ie. no colon (':')or semicolon (';') as for the Un*x/Linux or Win environments, respectively.
To specify the Class-Path tag in your MANIFEST.MF you need to include a line like the following:
Class-Path: lib/ojdbc14.jar lib/log4j.jar
Specifying MANIFEST.MF tags in JDevJDeveloper offers you two choices to specify your MANIFEST.MF tags. But before you can do this, you have to create a Deployment Profile for your JDev project (New... > General > Deployment Profiles). Once you have this profile in your project, open the Deployment Profile Properties dialog window. Navigate to the Options entry for specifying the tags.
Include the MANIFEST.MF FileTo make your specified tags available in your MANIFEST.MF, make sure to select the Include Manifest File (META-INF/MANIFEST.MF) checkbox.
Setting the Main-Class TagSince this is one of the most used tags, it got a primary location in the dialog and you get some help to find the right class. To complete the Main Class entry you can either enter the fully qualified class name or use the Browse button to find the right class.
Picture 1: Class Browser window
Setting the Class-Path TagTo specify the Class-Path tag in JDev you have to define a fragment file to be included in your MANIFEST.MF (or merged into the Manifest file). The fragment file could be in your source files and contains all the tags you'd like to specify.
Class-Path:For ease of work, I recommend to have a single line per library.
Picture 2: Deployment Profile window