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)
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. To see the libraries referenced by the project, I right-clicked the project and went to 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). This project build path information is stored in the project's .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. I named the library 'apache-tomcat-5.5.20-library' and clicked OK. 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. 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. When done adding all the jar files to the 'apache-tomcat-5.5.20-library' User Library, I clicked OK. (Continued on page 2) |