JAR file placement

If your JAR file is only used in a single Web application, always put the JAR file in the Web project's WebContent/WEB-INF/lib folder. The JAR files in this folder are automatically added to the Java build path, and will not require any further setup when moved to a different server.

If the JAR file is used by multiple modules within the same application, place the JAR file in the enterprise application, then use the Java JAR Dependencies feature to set up the manifest files and the Java build class paths. The Java JAR Dependencies Properties page of an EJB or Web project is used to identify which JARs in the enterprise application the EJB or Web project (respectively) uses. You can access the Java JAR Dependencies by selecting Properties from the pop-up menu of an EJB or Web project.

If the JAR file requires access to any J2EE or WebSphere classes, or to any other JAR files that have been added to ws.ext.dirs, it must also be placed on the ws.ext.dirs property. The ws.ext.dirs property is used for all JAR files that require access to the J2EE JAR files or WebSphere's internal classes. If there are hard dependencies on the JAR file, update the Java build path of each project that uses the JAR file. Any changes you want to make to ws.ext.dirs can be made using the server editor.

It is not recommended to put the JAR file on the global class path. Using one of the global class paths makes your application vulnerable to changes made to the classes on which you depend. If you have added the JAR file to the global class path or ws.ext.dirs properties you will have to publish the JAR file separately from your application, then you will have to set up the server class path again if you move to a different server.

 

Related concepts

JAR Dependency Editor