Setting up a User Library in Eclipse Build Path

Russell Bateman
Spring 2010
last update:

This article discusses how to set up library JARs in Eclipse Build Path.

Note: I no longer suggest the use of the Eclipse User Library though it is a superb concept and certainly works. Instead, I suggest another approach, detailed here.

To set up an Eclipse User Library, right-click the new BuildPathDemo project in the Package Explorer and choose Build Path, then Configure Build Path and click the Libraries tab:


   

Here are the steps to creating a new user library.

 

1. Click the Add Library button and select User Library:

 

2. Click Next...

 

3. Then click the User Libraries button:

4. Click New to create a new user library. Name it JarDemo:

 
  1. ...and click OK. Click the Add JARs... button
  2.  
  3. Navigate to JarDemo.jar in the filesystem; this was created at the root of the JarDemo project in our example; click OK.

7. Open the hierarchical triangle next to our new user library:

8. We'll attach the source code so that we can debug through it: Click Source attachment. Then, Edit and then the External Folder button. Navigate to src folder dominating Foo.java:

 

9. Click OK, then OK and select JarDemo:

  1. Click Finish and, finally, OK.

At this point, you'll find a new library in your project (in the Package Explorer view), named JarDemo.