WAS v8.5 > Administering applications and their environment > Administering the Liberty profile > Administering the Liberty profile manually > Configure class loaders and libraries for Java EE applications

Use a Java library with a Java EE application

In the following example, application Painter, running on server s1, needs access to the Haarlem library, which contains two files...

In use this library with the app...

  1. Create directory...

      ${WLP_USER_DIR}/usr/servers/s1/lib/Haarlem

  2. Copy haarlem-paintings.jar and commons-lang.jar to the new directory.

  3. In server.xml, or an included file, load the Haarlem library for the application...
    <application id="painter" 
                 name="Painter" 
                 type="ear" 
                 location="painter.ear"> 
      <classloader>     <privateLibrary>       <fileset dir="${server.config.dir}/lib/Haarlem" 
                   includes="*.jar" 
                   scanInterval="5s" />     </privateLibrary>   </classloader> 
    </application>

    The <privateLibrary> element can also take a filesetRef attribute with a comma-separated list of <fileset> element IDs.


Parent topic: Configure class loaders and libraries for Java EE applications


Related

Sharing a library across multiple Java EE applications
Providing global libraries for all Java EE applications
Accessing third-party APIs from a Java EE application
Removing access to third-party APIs for a Java EE application
Overriding a provided API with an alternative version