How to Add JARs to Project Build Paths in Eclipse (Java)

Part 1 of 5:

Adding Internal JARs

  1. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 1
    Create a new folder named lib in your project folder. This stands for "libraries" and will contain all the JARs you'll be using for that project.
  2. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 2
    Copy and paste the JARs you need to lib. Select the JAR files you need and right-click them. Select them and click copy. Then paste them into the lib folder by clicking File then Paste or using Control or Command V.
  3. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 3
    Refresh your project. Do this by right-clicking the project name and selecting Refresh. The lib folder will now be visible in Eclipse with the JARs inside.
Part 2 of 5:

Configuring Your Build Path

  1. Expand the lib folder in Eclipse. Click the arrow to the left of the folder to expand it.
  2. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 4
    Select all the JARs you need. Hold Shift and click the JARs in the expanded folder.
  3. Right-click the JARs. This opens a pop-up menu to the right.
  4. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 5
    Navigate to Build Path. Placing the mouse cursor over "Build Path" displays a submenu to the left.
  5. Select Add to Build Path. The JARs will disappear from lib and reappear in Referenced Libraries.
Part 3 of 5:

Configuring Your Build Path (Alternative Method)

  1. Right-click the project name. This displays a pop-up menu to the right.
  2. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 6
    Navigate to Build Path. It's in the pop-up menu that displays when you right-click on the project name. This displays a sub-menu to the right.
  3. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 7
    Click Configure Build Path. The project properties window will appear showing your build path configurations.
  4. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 8
    Select the Libraries tab. It's at the top of the project properties window.
  5. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 9
    Click Add JARs. It's on the right side of the project properties window.
  6. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 10
    Select the JARs you want and click OK. The JARs will now appear in the list of libraries in the build path.
  7. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 11
    Click OK to close the properties window. The JARs will now be in Referenced Libraries instead of lib.
Part 4 of 5:

Adding External JARs

  1. Right-click the project name. This displays a pop-up menu to the right.
    1. Note: It is much better to reference JARs that exist in your project or in other projects - this allows you to check in all of your dependencies to your version control system.
  2. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 12
    Navigate to Build Path. This displays a sub-menu to the right.
  3. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 13
    Click Configure Build Path. The project properties window will appear showing your build path configurations.
  4. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 14
    Click Add Variable. It's to the right of the project properties window.
  5. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 15
    Click Configure Variables. It's at the bottom of the New Variables window.
  6. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 16
    Click New. It's at the bottom of the preferences window.
  7. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 17
    Type a name for the new variable. For example, if these are JARs for Tomcat, perhaps you could call it "TOMCAT_JARS".
  8. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 18
    Browse to the directory that contains the JAR for the path. Click the Folder button and browse to the directory that contains the JAR path.
    1. You can also Click File and select a specific jar file for the variable, if you prefer.
  9. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 19
    Click OK. This defines the variables.
  10. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 20
    Click OK. This closes the preferences dialog.
  11. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 21
    Select the variable from the list. Click the variable to select it.
  12. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 22
    Click Extend. It's the button to the right of the list of variables.
  13. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 23
    Select the JAR(s) that you want to add to the classpath. Click to select the JARs. Hold Shift to select multiple JARs.
  14. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 24
    Click OK. This closes the extend dialog window.
  15. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 25
    Click OK. This closes the new classpath variable dialog.
  16. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 26
    Click OK. This closes the build path setup dialog.
    1. If you share the project with someone else, they must also define the variable. They can define it under Window->Preferences->Java->Build Path->Classpath Variables.

Adding External JARs (Alternative Method 1)

  1. Right-click the project name. This displays a pop-up menu to the side.
    1. Note: If you use this method, the external JAR will need to be in the same location on the hard drive for anyone who uses this project. This can make sharing a common project more difficult.
  2. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 27
    Navigate to Build Path. This displays a sub-menu to the right.
  3. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 28
    Click Add External Archives. It's in the Build Path sub-menu.

  4. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 29
    Select the JARs you want and click Open. The JARs will now appear in Referenced Libraries.
Part 5 of 5:

Adding External JARs (Alternative Method 2)

  1. Right-click the project name. This displays a pop-up menu to the right.
    1. Note: If you use this method, the external JAR will need to be in the same location on the hard drive for anyone who uses this project. This can make sharing a common project more difficult.
  2. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 30
    Navigate to Build Path. It's in the pop-up menu that appears when you right-click the project name.
  3. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 31
    Click Configure Build Path. The project properties window will appear showing your build path configurations.
  4. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 32
    Select the Libraries tab. It's at the top of the project properties window.
  5. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 33
    Click Add External JARs. It's on the right side of the project properties window.
  6. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 34
    Select the JARs you want and click Open. The JARs will now appear in the list of libraries in the build path.
  7. How to Add JARs to Project Build Paths in Eclipse (Java) Picture 35
    Click OK to close the properties window. The JARs will now be in Referenced Libraries.
4.1 ★ | 8 Vote

May be interested

  • How to Copy Files to an External Hard DrivePhoto of How to Copy Files to an External Hard Drive
    this wikihow teaches you how to copy files that are on your computer onto a portable hard drive, flash drive, or memory card. determine the connection type for the hard drive and your computer. virtually all external hard drives use a usb...
  • How to Extract a JAR FilePhoto of How to Extract a JAR File
    this wikihow teaches you how to extract a jar file's contents. jar files are zipped java files that are typically executed within a java environment. while extracting jar files can be tricky depending on your computer's operating system,...
  • How to Open the Hidden Files in a USB Pen DrivePhoto of How to Open the Hidden Files in a USB Pen Drive
    this wikihow teaches you how to force hidden files that are on your usb flash drive to display so that you can open them. you can perform this process on both windows and mac computers. plug your usb drive into your computer. insert the...
  • How to Open a Zip FilePhoto of How to Open a Zip File
    this wikihow teaches you how to open and extract a zip folder on your computer, smartphone, or tablet. zip folders are used to compress files into smaller versions, making them easier to store and transport. in order to view and use a zip...
  • How to Open 7z FilesPhoto of How to Open 7z Files
    if you've come across a file that ends in '.7z', you're probably wondering why you can't open it. these files, known as '7z' or '7-zip files,' are archives of one or more files in one single compressed package. you'll need to install an...
  • How to Copy Your DVDs With Mac OS XPhoto of How to Copy Your DVDs With Mac OS X
    this wikihow teaches you how to use your mac to duplicate a data or video dvd. if the dvd is unprotected, you can copy it using mac's built-in disk utility app. if the dvd is protected, which is usually the case with official movie...