Import the jar package into the Java project in ecipse: 1. Use maven, 2. Common method

One use maven to import the jar package


Right-click the project-Configure-to maven into a maven project


Completed directly, you can also change the parameters according to the installation requirements


After the conversion is successful, find the pom.xml under the project as shown in the figure.


Next, we visit the website that supports maven services in the browser

The following takes mvn network as an example: https://mvnrepository.com/

Search for the required jar package directly in the search. Here JDBC is an example


Select the required jar from the searched jar package.


After finding the jar package as needed, it is recommended to download the version with higher usages, or you can choose it as needed


Select Finish, find the location as shown, copy all the code of the <dependency> tag (as shown in the red box)


Go back to pom.xml, write the <dependencies> </dependencies> tag above the </project> tag, and then paste the copied content in <dependencies>here </dependencies>. . . . As shown


Next, you only need to save the xml, and you can find the jar package downloaded by maven in the directory as shown in the figure. The project can be called without other configuration. In general, the advantage is that there are websites that provide jar package services.





2 Use the normal method

Right-click the item to create a new Floder


Enter lib to create a folder in the location shown in the figure, Finish is completed


Then copy the jar package you downloaded from the indescribable website into the lib folder. on the sites mentioned above

https://mvnrepository.com/

You can also download the jar package directly


Right-click the project, click Properties


Click java Build Path, then click Add JARs..., different versions of eclipse will be different, understand by yourself


找到项目目录下的lib再选你的jar包,点ok


再应用或者直接ok


这样就完成了,你就可以嘿嘿jar包了

点击打开链接

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325502525&siteId=291194637