How to import a jar file in Eclipse

+5 votes
May 15, 2018 in Java by Sushmita
• 6,920 points
359,822 views

11 answers to this question.

+1 vote

To import jar file in your Eclipse IDE, follow the steps given below.

  1. Right click on your project
  2. Select Build Path
  3. Click on Configure Build Path
  4. Click on Libraries and select Add External JARs
  5. Select the jar file from the required folder
  6. Click and Apply and Ok
answered May 15, 2018 by sharth
• 3,370 points
when I Click on Libraries  it is disabled

You might not have selected either Modulepath or Classpath.

same problem with me
which one we should select module path or class path?

Hey,

I would suggest, select classpath it will be helpful for you. A module path is a very new thing in Java 9.

+1 vote
  1. Click on File > Import. The Import window will open.

  2. Under Select an import source, click on J2EE > App Client JAR file.

  3. Click Next.

  4. In the Application Client file field, enter the location and name of the application client JAR file that you want to import. You can click the Browse button to select the JAR file from the file system.

  5. In the Application Client project field, type a new project name or select an application client project from the drop-down list. If you type a new name in this field, the application client project will be created based on the version of the application client JAR file, and it will use the default location.

  6. In the Target runtime drop-down list, select the application server that you want to target for your development. This selection affects the run time settings by modifying the class path entries for the project.

  7. If you want to add the new module to an enterprise application project, select the Add project to an EAR check box and then select an existing enterprise application project from the list or create a new one by clicking New.

    Note: If you type a new enterprise application project name, the enterprise application project will be created in the default location with the lowest compatible J2EE version based on the version of the project being created. If you want to specify a different version or a different location for the enterprise application, you must use the New Enterprise Application Project wizard.

  8. Click Finish to import the application client JAR file.

answered Aug 23, 2018 by Daisy
• 8,140 points
0 votes

You can add a jar file in Eclipse by:
right-clicking on the Project → Build Path → Configure Build Path.
Under Libraries tab, click Add Jars or Add External JARs and give the Jar.

Simple as that.

answered Dec 10, 2018 by Nish
I’m unable to add external jar files as add external jar file option is disabled state.So please help me how to resolve and I selected use default JRE i.e latest jdk when creating a new project.
Have you selected a Modulepath or a Classpath?
Which one to select,Module path or class path??
Class path worked for me.
–1 vote

The best way is to add the jar to your project is as follows:

  1. Create a folder called lib in your project folder.

  2. copy all the jar files you need to this folder .

  3. Refresh your project in eclipse.

  4. Select all the jar files, then right click on one of them and select Build Path -> Add to Build Path

answered Dec 10, 2018 by Shuvodip
Does u mean, any where in the project or specifically in some location of the project?
Hey @Myzee you need to right click on your project's name and go to "build path" and then add the dependency jar files. You could probably refer to @Nabarupa's answer, it gives a pictorial description for your problem.
0 votes

This way you can add an external jar file to your project

answered Dec 10, 2018 by Nabarupa
0 votes

Eclipse -> Preferences -> Java -> Build Path -> User Libraries -> New(Name it) -> Add external Jars

Done.

answered Dec 10, 2018 by Timsberg
0 votes

Right click on your project and choose Build Path -> Add Library

Then configure the build path and you are good to go.

answered Dec 10, 2018 by Ritesh Kumar
0 votes
In eclipse

right click on your project

Click build path

Add external libraries

You are good to go.
answered Dec 10, 2018 by kaur harpreet
0 votes

right click in your mouse on the project and select properties in the bottom and select build in path in the left corner and add external jar file add click apply .that's it

answered Dec 10, 2018 by princy doshi
0 votes
Go to your project right click and select build path

then configure path and add your jar files in bin and you are good to go
answered Dec 10, 2018 by Hola77
0 votes

Hey Guys,

We just need to download the jars and include them in eclipse.

  1. Step 1: Go to the official website and click on the Download tab.
  2. Step 2: Click on the Download link to download the jars for selenium.
  3. Step 3: Extract the downloaded folder and we will get the folder like selenium-java-3.141.
answered Dec 9, 2020 by Gitika
• 65,770 points

Related Questions In Java

0 votes
1 answer

How to run a JAR file in Java?

The command given below will help you ...READ MORE

answered Jun 1, 2018 in Java by Parth
• 4,640 points
7,425 views
+5 votes
4 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,450 points

edited Nov 7, 2018 by Omkar 81,240 views
0 votes
3 answers

How to read a Text File in Java?

You can use readAllLines and the join method to ...READ MORE

answered Jul 28, 2018 in Java by samarth295
• 2,220 points
2,493 views
0 votes
3 answers

How to check whether a file exists or not in Java?

Using nio we can check whether file ...READ MORE

answered Aug 14, 2018 in Java by Sushmita
• 6,920 points
4,085 views
0 votes
1 answer

How can we import javax.servlet API in Eclipse?

Before installing Eclipse, ensure that you are ...READ MORE

answered Jun 7, 2018 in Java by Parth
• 4,640 points
2,996 views
+29 votes
3 answers

How can we set java.library.path in Eclipse?

Go into the library settings for your ...READ MORE

answered Jul 3, 2018 in Java by sharth
• 3,370 points
22,350 views
+2 votes
3 answers

Selenium Webdriver + Java - Eclipse: java.lang.NoClassDefFoundError

I also faced this issue first time, ...READ MORE

answered Aug 28, 2019 in Selenium by Shraddha
71,844 views
0 votes
1 answer

Which is the best GUI designer for Eclipse?

Windows Builder Pro is the best GUI ...READ MORE

answered May 21, 2018 in Java by Akrati
• 3,190 points
1,780 views
0 votes
1 answer

How to Read/Write String from a File in Android

Writing a File in android: private void writeToFile(String ...READ MORE

answered Oct 3, 2018 in Java by sharth
• 3,370 points
7,372 views
0 votes
2 answers

How can I convert a String variable to a primitive int in Java

 Here are two ways illustrating this: Integer x ...READ MORE

answered Aug 20, 2019 in Java by Sirajul
• 59,230 points
2,315 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP