This topic describes techniques for managing the location and availability of JARs and WebLogic J2EE Shared Libraries in your projects and enterprise applications.
The IDE builds projects using project source files as well as JARs that are stored in the project or outside the project as J2EE libraries. Multiple projects can reference a single copy of a J2EE library stored on the server alleviating the need to create separate copies of the library in each project.
There are two types of libraries that you can add to a project or application
For more information on J2EE libraries, consult your WebLogic Server documentation locally or online. J2EE libraries can be:
You can add JARs to your projects by copying them to your project folders. Note that you may need to right click on the Project Explorer view and click Refresh to update the file list.
JAR files copied into the EarContent/APP-INF/lib directory of an EAR project are added to the buildpath of all projects included in the EAR. You do not need to configure project dependencies on such JAR files. Objects in the JAR will simply appear in the IDE and they will be available at build and deployment for all projects in the EAR.
JAR files copied into the WebContent/WEB-INF/lib directory of a web project are added to the buildpath of that project. The contents of the JAR file will appear in the IDE and they will be available at build and deployment for that single project only.
When creating a project in Workshop for WebLogic, the project facets that are selected for the project determine what J2EE libraries are required. You may also add project facets after a project is created. (Some facets cannot be removed after a project is created.) J2EE libraries can be handled one of two ways:
When you create a web project, one of the screens allows you to specify whether this project will share J2EE libraries (Use Shared J2EE Libraries) or create a copy of the J2EE libraries in the current project (Do not use Shared J2EE Libraries. Copy all required JARs into the WEB-INF/lib directory).
This setting is persistent and affects how WebLogic J2EE shared libraries are handled if you later add/remove facets using the Project Facets properties page.
You may have access to other J2EE libraries that you want to use in more than one project. You can use these J2EE libraries in your projects by doing the following:
Click Add to add a new library. (Or click Add Multiple to multi-select multiple libraries.)
Browse to and select the library (or libraries).
Click the Browse button.
In the Select WebLogic J2EE Library dialog, select a library and click OK.
On the Add Library dialog, click Finish.