Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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).

like image 856
Roman Avatar asked Apr 28 '10 07:04

Roman


People also ask

Why can't I add external JARs in Eclipse?

You have selected the JRE System Library in the panel. Un-select that and you will be able to add external jars. You can click on the Classpath or Modulepath to move the control away.


1 Answers

  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.

like image 58
Christopher Klewes Avatar answered Oct 17 '22 22:10

Christopher Klewes