What is a user library and how do I use it?
Author: Deron Eriksson
Description: This tutorial describes how to create a User Library in Eclipse.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 2.0 (Eclipse 3.3.0)

Page:    1 2 >

A User Library in EclipseSW can be a useful way to organize a set of jarW files. If you have a set of jar files that you use in several projects, you can create a User Library to reference the set of jar files. As a result, all you would need to include in your project's build path is the User Library rather than all the individual jar files.

I'll demonstrate how to create and use a User Library using the tomcat-demo project, which utilizes ApacheSW TomcatSW.

'tomcat-demo' project

To see the libraries referenced by the project, I right-clicked the project and went to Properties.

'tomcat-demo' properties

On the libraries tab, you can see that I include lots of Tomcat jar files in the project build path via the CATALINA_HOME ClasspathW Variable (which points to C:\apache-tomcat-5.5.20).

Java Build Path Libraries

This project build path information is stored in the project's .classpath file.

.classpath file

Now, I'll create a User Library to represent all of the Tomcat jar files that we'd like to have. I went to Windows → Preferences → JavaSW → Build Path → User Libraries. I clicked New to create a new User Library.

User Libraries

I named the library 'apache-tomcat-5.5.20-library' and clicked OK.

New User Library

The 'apache-tomcat-5.5.20-library' now appears in the list of User Libraries. I clicked Add JARs to add jars to the User Library.

Add JARs to User Library

I navigated to the jar files that I wanted to add and added them to the User Library. I did this for all of the jars that I wanted to add to the User Library.

Selecting jars

When done adding all the jar files to the 'apache-tomcat-5.5.20-library' User Library, I clicked OK.

User Libraries

(Continued on page 2)

Page:    1 2 >