How to add external jar packages in eclipse

Source: Internet
Author: User

Method 1:

Right-click your project directory and choose Properties From the shortcut menu]PropertiesAnd then select [Java build path]JavaBuildPath, The third item on the right tab [database]LibrariesAnd click Add jars on the right]AddJars
Or select the second [add external jars]AddExternalJarsFind the jar package to be added and add it;

Method 2:

One disadvantage of adding an external jar package is that when our project is moved to another directory, or we often need to move the project to another machine for running, after re-importing the project, you will find that the original jar package cannot be found. Sometimes we want to use the jar package as a part of the project, move it as the project moves, and find these jar packages after moving.

In a web project, you can directly copy the jar package to be imported to the WEB-INF/lib folder under your project, and the program can run normally when it is moved to another machine.

If it is a common Java project, we can create a new Lib folder in the project folder and put all the jar packages we need into the Lib folder,Remember to refresh the project in eclipseSo that the project can identify the newly created lib folder. Then use the method in method 1 to openJavaBuildPath, ClickAdd
Jars
Select all the jar packages in the Lib folder.

 

Method 3:

First use method 2 and then use method 1.

 

If it is a web project, we recommend that you use method 2 first. If not, you can use method 3.

Note: In method 2, when you add an external jar package to the project folder (for example, when writing a web project, we may copy the jar package to the WEB-INF/lib folder ), the newly added jar package is not displayed in eclipse. In this case, you can refresh the project (right-click your project directory and click Refresh.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.