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

Provide global libraries for all Java EE applications

We can provide global libraries that can be used by any application. You do this by putting the JAR files for those libraries in a global library directory, then specifying use of global libraries in the class loader configuration for each application. Under the user directory specified using the environment variable WLP_USER_DIR, there are the following locations in which we can place global libraries:

If there are files present in these locations at the time an application is started, and that application does not have a < classloader> element configured, the application uses these libraries. If a class loader configuration is present, these libraries are not used unless the global library is explicitly referenced.


If you use global libraries, you are advised also to configure a < classloader> element for every application. The servlet specification requires applications to share the global library class loader in their class loader parent chain. This breaks the separation of class loaders for each application otherwise possible. So, applications are more likely to have long-lasting effects on classes loaded in Liberty and on each other, and class space consistency issues are more likely to arise between applications, especially as features are added and removed from a running server. None of these considerations apply for applications that specify a < classloader> element in their configuration, because they maintain this separation.


In the following example, an application called Painter is configured to use a common library called Haarlem, and also to use the global library.

In server.xml, or an included file, enable the global library for an application by adding the following code:

The settings for the global library can also be configured explicitly, as a library element with the special ID global. For example:

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


Use a Java library with a Java EE application
Sharing a library across multiple Java EE applications
Access third-party APIs from a Java EE application
Remove access to third-party APIs for a Java EE application
Overriding a provided API with an alternative version
Liberty profile environment variables



Search Tips   |   Advanced Search