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

4

6

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

Caprice answered 28/4, 2010 at 7:57 Comment(0)
T
7
  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.

Thirtieth answered 28/4, 2010 at 7:59 Comment(4)
Sounds simple. But how do I find the .jar file to make the right click on it?Caprice
Maybe you have to Refresh your project (select your project and press F5)? Did you copied it there via Eclipse or File System?Thirtieth
I copied it there with the File System. How can I refresh the Project?Caprice
Did my hints worked for you? If you like my answer you can consider accepting it.Thirtieth
B
2

I think you are almost correct in adding the jar files to the Selected Project

Right click on the name of the project.

Click on Properties in the menu.

Click on "Java Build Path"

Then select "Libraries"

In "Libraries" Click "Add External JARs...".(if the jar files exists outside the project) Else Click "Add Jars" (if the jars Exists within the project)

Once you do this, workspace builds automatically and after that your application is set to use for the development.

Bindle answered 28/4, 2010 at 8:6 Comment(0)
G
0

Click "Add Jar" and select the jar from your project path.

Germaun answered 28/4, 2010 at 7:59 Comment(1)
Should I do it in the "Libraries" tub? (I see "Add JAR" only there). If I go to the "lib" sub-folder I do not see there the .jar file (but it is there, I see it if I go to the folder with the file explorer).Caprice
P
0

If the jar is already in you project directory click "Add jar" in the Libraries-tab. If not click "Add external jar". That should do it.

If your jar does not show up when you click "Add jar" although you have copied it to your project directory you should refresh your project. Just go to your project explorer in eclipse, right click on the project-name and click "Refresh".

Para answered 28/4, 2010 at 8:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.