How can I add a .jar to my build path in Eclipse?

Roman picture Roman · Apr 28, 2010 · Viewed 11.4k times · Source

I try to do it the following way:

  1. Right click on the name of the project.

  2. Click on Build Path in the drop dawn menu.

  3. Click on "Configure Build Path"

And then I do not know what to do. Should I select "Source", "Projects", "Libraries", "Order and Export"?

In "Libraries" I have "Add JARs..." and "Add External JARs...". What should I select? (I have already a .jar file in the lib folder of my project.)

ADDED:

If I click on "Add JARs" in the "Libraries" tab, I see the "lib" sub-folder but if I go there I do not see my .jar file there (and I know that it is there).

Answer

Christopher Klewes picture Christopher Klewes · Apr 28, 2010
  1. Right click on the jar you want to add.
  2. Build Path > Add to Build Path

You're done.

If you want to add the Library with the Java Build Path view, as you tried you have to use Add JARs. If you copied the library via File System the Project is not in sync. You could press F5 on the selected Project.

If you edit outside of Eclipse a lot, you can enable auto-refresh by going to Window > Preferences menu, then in the Preferences dialog box, select General > Workspace. Check the Refresh automatically box.