• About
  • Contact
  • Cookie
  • Disclaimer
  • Privacy Policy
  • Change the purpose of use

Tnhelearning.edu.vn - Various useful general information portal

  • Photo
  • Bio
  • How To
  • Tech

How to Add JAR to Project Build Path in Eclipse (Java)

February 17, 2024 by admin Category: How To

You are viewing the article How to Add JAR to Project Build Path in Eclipse (Java)  at Tnhelearning.edu.vn you can quickly access the necessary information in the table of contents of the article below.

X

wikiHow is a “wiki” site, which means that many of the articles here are written by multiple authors. To create this article, 16 people, some of whom are anonymous, have edited and improved the article over time.

This article has been viewed 7,825 times.

When your Java project requires a JAR (Java Archive) library to run, you need to customize your project to add the libraries to the build path. Fortunately, Eclipse makes this process simple and easy to remember. The build version used in this article is Eclipse Java – Ganymede 3.4.0.

Table of Contents

  • Steps
    • Add inner JAR (Internal)
    • Add External JAR (External)
  • Advice

Steps

Add inner JAR (Internal)

Copy the JAR you will use for your project. Usually the steps are as follows:

  • Create a new folder called lib in your project folder. This stands for “libraries” that includes the entire JAR you will use for that project.
    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 1Bullet1

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 1Bullet1

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/0/02/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-1Bullet1.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-1Bullet1.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/0/02/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-1Bullet1.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-1Bullet1.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
  • Copy the JARs you need into lib .
    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 1Bullet2

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 1Bullet2

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/3/38/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-1Bullet2.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-1Bullet2.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/3/38/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-1Bullet2.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-1Bullet2.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
  • Refresh your project by right clicking on the project name and selecting Refresh . The lib folder should now appear in Eclipse, with the JAR inside.
    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 1Bullet3

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 1Bullet3

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/b/ba/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-1Bullet3.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-1Bullet3.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/b/ba/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-1Bullet3.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-1Bullet3.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Do one of the methods below to finish customizing your build path.

Method 1

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 3

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 3

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/4/46/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-3.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/4/46/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-3.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-3.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Open the lib in Eclipse and select all the JARs you need.
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 4

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 4

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/7/70/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-4.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-4.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/7/70/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-4.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-4.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Right click on the JAR and point to Build Path .
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 5

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 5

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/a/ab/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-5.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-5.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/a/ab/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-5.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-5.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Select Add to Build Path . The JAR will disappear from the lib and reappear in the Referenced Libraries .

Method 2

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 6

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 6

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/2/2d/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-6.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-6.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/2/2d/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-6.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-6.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Right click on the project name and point to Build Path .
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 7

READ More:   How to Disable Adblock

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 7

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/b/ba/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-7.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-7.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/b/ba/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-7.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-7.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Select Configure Build Path… and the Project Properties window will appear for you to customize the build path.
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 8

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 8

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/5/5c/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-8.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-8.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/5/5c/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-8.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-8.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Select the Libraries tab.
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 9

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 9

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/5/54/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-9.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-9.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/5/54/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-9.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-9.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Click Add JARs… (Add JARs)
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 10

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 10

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/3/31/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-10.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-10.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/3/31/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-10.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-10.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Search and select the desired JAR then click OK . The JAR will now appear in the list of libraries in the build path.
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 11

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 11

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/f/fb/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-11.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-11.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/f/fb/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-11.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-11.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Click OK to close the Properties window. The JAR will now be in Referenced Libraries instead of in lib .

Add External JAR (External)

Note: It is better to reference the JAR that is present in your project or another project – This helps you to check all the dependencies in the version control system (version contrp). (You ‘re using a version management system, right?). Use one of the methods below.

Method 1

This is the preferred method because it allows multiple developers of the same project to search for external jars in different locations.

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 12

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 12

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/5/53/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-12.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-12.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/5/53/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-12.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-12.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Right click on the project name and point to Build Path .
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 13

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 13

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/f/f4/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-13.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-13.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/f/f4/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-13.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-13.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Select Configure Build Path… and the project Properties window will be displayed, allowing you to customize your build path.
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 14

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 14

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/3/31/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-14.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-14.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/3/31/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-14.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-14.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Click Add Variable… (Add Variable)
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 15

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 15

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/5/53/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-15.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-15.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/5/53/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-15.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-15.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Click Configure Variables… (Customize Variables)
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 16

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 16

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/7/70/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-16.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-16.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/7/70/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-16.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-16.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Click New… (New Variable)
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 17

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 17

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/1/1d/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-17.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-17.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/1/1d/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-17.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-17.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Type a name for the new variable. For example: If it is a JAR of Tomcat, it can be named TOMCAT_JARS
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 18

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 18

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/c/c1/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-18.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-18.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/c/c1/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-18.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-18.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Navigate to the directory containing the JAR to use as the path. (You can also select a specific jar file for the variable if you want.)
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 19

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 19

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/9/93/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-19.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-19.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/9/93/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-19.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-19.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Click Ok to define the variable.
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 20

READ More:   How to Bond with a Cat

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 20

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/6/65/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-20.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-20.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/6/65/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-20.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-20.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Click Ok to close the options dialog box.
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 21

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 21

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/b/be/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-21.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-21.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/b/be/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-21.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-21.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Select variable from the list.
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 22

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 22

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/4/45/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-22.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-22.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/4/45/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-22.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-22.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Click Extend… (Expand)
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 23

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 23

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/8/84/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-23.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-23.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/8/84/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-23.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-23.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Select one or more JARs that you want to add to the classpath variable.
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 24

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 24

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/7/75/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-24.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-24.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/7/75/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-24.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-24.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Click Ok to close the extension dialog box.
Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 25

Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 25

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/a/ae/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-25.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-25.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/a/ae/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-25.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-25.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
Click Ok to close the new classpath variable dialog box.
  • Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 26

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 26

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/6/62/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-26.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-26.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/6/62/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-26.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-26.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
    Click Ok to close the build path settings dialog box.

    • If you share the project with others, they must also define the variable. They can define it in

      Window->Preferences->Java->Build Path->Classpath Variables

  • Method 2

    Note that if you use this method, the external JAR must be in the same location on everyone’s hard drive. This can make it more difficult to share a common project.

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 12

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 12

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/5/53/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-12.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-12.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/5/53/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-12.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-12.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
    Right click on the project name and point to Build Path .
    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 28

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 28

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/6/61/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-28.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-28.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/6/61/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-28.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-28.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
    Select Add External Archives… (Add External Archives)
  • Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 29

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 29

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/c/c4/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-29.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-29.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/c/c4/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-29.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-29.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
    Search and select the JAR you want and then click Open . The JAR will now appear in Referenced Libraries .
  • Method 3

    Note that if you use this method, the external JAR must be in the same location on whoever’s hard drive is working on the project. This can make sharing a joint project more difficult.

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 12

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 12

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/5/53/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-12.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-12.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/5/53/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-12.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-12.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
    Right click on the project name and point to Build Path .
    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 13

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 13

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/f/f4/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-13.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-13.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/f/f4/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-13.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-13.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
    Click Configure Build Path… and the project Properties window will be displayed to customize your build path.
    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 32

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 32

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/2/2e/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-32.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-32.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/2/2e/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-32.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-32.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
    Select the Libraries tab.
    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 33

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 33

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/1/1f/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-33.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-33.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/1/1f/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-33.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-33.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
    Click Add External JARs… (Add External JARs)
    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 29

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 29

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/c/c4/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-29.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-29.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/c/c4/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-29.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-29.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
    Search and select the desired JAR and click Open . The JAR should now appear in the library list of the build path.
  • Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 35

    READ More:   How to Remove Abscess

    Image titled Add JARs to Project Build Paths in Eclipse (Java) Step 35

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/0/0a/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-35.jpg /v4-728px-Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-35.jpg”,”bigUrl”:”https://www.wikihow.com/images/ thumb/0/0a/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29-Step-35.jpg/v4-728px-Add-JARs-to-Project-Build-Paths-in -Eclipse-%28Java%29-Step-35.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw -parser-output”></div>”}
    Click OK to close the Properties window. The JAR will now be in Referenced Libraries .
  • Advice

    • Every time you add a new file or folder to your project in Eclipse through anything other than Eclipse, you must refresh the affected projects so Eclipse knows where the new files are. Otherwise you may get a compile error or a build path error.
    • Even though the internal JARs disappear from lib , they still exist in the filesystem. This is just Eclipse’s way of notifying you that those JARs have been added.
    • To be on the safe side, you’ll probably need to create a folder to write your code notes in the text. Here’s how to do it:
      • Right-click the .JAR in the Reference Libraries in the package explorer.
      • Select the Javadoc tag and type the directory (or URL) containing the text. (Note: Eclipse doesn’t like this and the validation will fail. Don’t worry though, it will work.)
      • Select Java Source Attachment and search for the folder or .JAR file containing the source.
    X

    wikiHow is a “wiki” site, which means that many of the articles here are written by multiple authors. To create this article, 16 people, some of whom are anonymous, have edited and improved the article over time.

    This article has been viewed 7,825 times.

    When your Java project requires a JAR (Java Archive) library to run, you need to customize your project to add the libraries to the build path. Fortunately, Eclipse makes this process simple and easy to remember. The build version used in this article is Eclipse Java – Ganymede 3.4.0.

    Thank you for reading this post How to Add JAR to Project Build Path in Eclipse (Java) at Tnhelearning.edu.vn You can comment, see more related articles below and hope to help you with interesting information.

    Related Search:

    Related Posts

    How to Create Curved Text in Photoshop
    How to fall asleep faster
    How to Install FBReader to Read eBooks

    Category: How To

    Previous Post: « How to Shift Gears on a Motorcycle
    Next Post: How to Know the Value of an Emerald »

    Copyright © 2025 · Tnhelearning.edu.vn - Useful Knowledge