Import external jar package in Eclipse

When writing java code, in order to facilitate programming, we often refer to methods that others have implemented, which are usually packaged into jar packages. When we write, we only need to introduce them into Eclipse.

Tools/Materials

  • Eclipse
  • The jar package that needs to be imported

method/step

  1. 1

    First create a folder under the project to save our jar package.

    Right-click on the project name and click [New]-->[Floder] to open the New Folder window

    Import external jar package in Eclipse
  2. 2

    Enter the folder name [lib] and click [ok]. We usually store the jar package imported from the outside in the lib folder

    Import external jar package in Eclipse
  3. 3

    Find the jar package we want to import, select the jar package with the mouse, then hold down the left mouse button and drag the jar package to the lib folder. Or copy the jar package first, then right-click on the lib folder and select Copy. At this point, open the selection box, we select the default [copy files], and click [OK] to close. Then we can see the jar package we copied successfully in the lib folder.

    Import external jar package in Eclipse
    Import external jar package in Eclipse
  4. 4

    At this point, just copy the jar package to the project, but it cannot be used. We then right-click on the project name and select

    【Build Path】-->【Configure Build Path...】。

    Import external jar package in Eclipse
  5. 5

    In the opened window, first select the [Libraries] page, and then click the button on the right

    【add JARs...】

    Import external jar package in Eclipse
  6. 6

    In the opened window, we expand the project and lib folder of this project in turn, then select the jar package we just copied to the project, and then click [OK] to close the window

    Import external jar package in Eclipse
  7. 7

    At this point, we can see the name of the jar package we imported in the [Libraries] page we just opened. Click [OK] to confirm.

    Import external jar package in Eclipse
  8. 8

    At this point, in Eclipse, we can use this jar package.

    Import external jar package in Eclipse
    END

Precautions

  • When we don't need the jar package, just delete the jar package in reverse order.
The experience content is for reference only. If you need to solve specific problems (especially in the fields of law, medicine, etc.), it is recommended that you consult professionals in relevant fields in detail.
report Author's statement: This experience is originally based on my real experience, and I refuse to reprint it without permission.
Voting (192)
Got (0)
I have questions (0)
Related tags eclipse

Guess you like

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