简体   繁体   中英

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

  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.

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.

单击“添加Jar”并从项目路径中选择jar。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM