Previous Next vertical dots separating previous/next from contents/index/pdf

Setting up JAR and J2EE Library Dependencies

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:

 

Adding JARs to Your Projects

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.

Option 1: Add a JAR to an Enterprise Application

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.

Option 2: Add a JAR to a Single Web Project

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.

Managing How Facets Make J2EE Libraries Available to Projects

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:

  1. Workshop for WebLogic allows you to use the WebLogic Server shared J2EE libraries feature which makes the J2EE libraries available on the build path but does not make copies of the J2EE libraries in every project where it is used.
  2. The J2EE standard method is to copy the JARs inside a J2EE library into the WEB-INF/lib folder of the project.

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.

Add a J2EE Libraries to a Project

Add Custom J2EE Libraries to a Project

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:

  1. Register the library with Workshop for WebLogic by clicking Window > Preferences > Weblogic > J2EE Libraries.

  2. Click Add to add a new library. (Or click Add Multiple to multi-select multiple libraries.)

  3. Browse to and select the library (or libraries).

  4. When the library or libraries have been added to the list of registered libraries, click OK to close the Preferences dialog.
  5. In the Project Explorer, right-click the target project and select Build Path > Add Libraries.
  6. On the Add Library dialog, select the library type to add and click Next.

    img

    Click the Browse button.

    img

    In the Select WebLogic J2EE Library dialog, select a library and click OK.

    img

    On the Add Library dialog, click Finish.

    img

Related Topics

Edit Library - WebLogic J2EE Library Dialog

 

Skip navigation bar   Back to Top