Specifying dependent JAR files or modules
You can use the JAR Dependencies editor to specify JAR files or modules that are required by a module. The dependencies are defined in the MANIFEST.MF file for your module.
When you are specifying required JAR files or modules, you first specify the enterprise application (EAR) that your project is a part of. Usually, the project will be referenced by one EAR project in the workspace. However, it is possible that you will have multiple enterprise applications that contain a reference to the same module or utility JAR project. If this is the case, then you should ensure that you give the JAR or module the same URI in each application, so that the class path will be valid for all applications.
It is also possible that your module is a standalone project and is not currently referenced by any enterprise application. In this case, since there is no enterprise application scope defined, you cannot use the JAR Dependency editor to update the dependencies. To add the module to an enterprise application, see Adding modules to an enterprise application.
To specify the JAR files or modules in an enterprise application that are required by a module:
- In the Project Explorer view of the J2EE perspective, right-click your project's MANIFEST.MF file, and select Open With > JAR Dependency Editor from the pop-up menu. The META-INF file is located in the following locations for the different module types:
EJB projects ejbModule/META-INF/MANIFEST.MF Application client projects appClientModule/META-INF/MANIFEST.MF Dynamic Web projects WebContent/META-INF/MANIFEST.MF Connector projects connectorModule/META-INF/MANIFEST.MF Tip: For application client modules, you can also click Edit in the Main-Class section of the Client Deployment Descriptor editor to launch the JAR Dependency Editor.- In the Classpath Scope section of the editor, select the enterprise application to use for class path editing. Because the JAR dependency editor is designed for class path editing, not all of the attributes or information contained in the manifest file (MANIFEST.MF) are represented on the this page. The Classpath Scope section lists all enterprise applications that contain a reference to the selected project as a module or utility JAR. Use the Refresh button to update the list if a change is made in a separate editor.
- In the Dependencies section, select the JAR files or modules that are required or dependent. You can also move them up and down in the list to specify their order on the MANIFEST class path as well as the Java build path.
In cases where your module depends on an EJB module that has an EJB client JAR file, you can choose whether you want to depend on the EJB JAR file or the EJB client JAR file. If you select the Use EJB JARs radio button, the table will not show any EJB client JAR files. If you select the Use EJB client JARs radio button, the table will not show any EJB JAR files that have corresponding EJB client JAR files. If you select the Allow both radio button, the table shows EJB JAR files and EJB client JAR files and allows you to select both types.
Tip: The Dependencies section automatically switches dependencies based on which radio button you select. For example, if you have a dependency set on an EJB JAR file and you select the Use EJB client JARs radio button, the dependency will switch to the appropriate EJB client JAR file. If you select the Allow both radio button, none of your dependency selections will change automatically.- Click File > Save to save your changes.
Tip: If you need to compile against a server's runtime JAR files during development, you do not need to add these JAR files as dependent JAR files. The workbench manages this by using the target server property for the project. The workbench adds the appropriate libraries to your project's build and class path based on the target server. See Specifying target servers for J2EE projects for more information.
Related concepts
Client Deployment Descriptor editor
build path is updated accordingly for the containing project. It also sets the Main-Class attribute of the manifest, which is typically only used for application client modules.">JAR dependency editor
Cyclical dependencies between J2EE modules
Related tasks
Defining the Main Class for J2EE modules
Importing an enterprise application EAR file
Correcting cyclical dependencies after an EAR is imported