ferz
ferz

Reputation: 503

How can I add JAR files to the web-inf/lib folder in Eclipse?

I'm using Eclipse and I need to be able to add Java libraries (JAR files) into my web application's WEB-INF/lib folder. How do I achieve this?

Upvotes: 31

Views: 145566

Answers (10)

Adopted Idiots
Adopted Idiots

Reputation: 327

Add the jar file to your WEB-INF/lib folder. Right-click your project in Eclipse, and go to "Build Path > Configure Build Path" Add the "Web App Libraries" library This will ensure all WEB-INF/lib jars are included on the classpath. helped me..

Drag and drop in WEB-INF/lib folder and restart eclipse ans start webservice then create client

Upvotes: 0

Shaina Raza
Shaina Raza

Reputation: 1638

add the jar to WEB-INF/lib from file structure refresh the project, you should see the jar now visible under the WEB-INF/lib folder.

this is the best solution that worked for me

Upvotes: 2

Saurabh Saha
Saurabh Saha

Reputation: 1153

  1. add the jar to WEB-INF/lib from file structure
  2. refresh the project, you should see the jar now visible under the WEB-INF/lib folder.

Upvotes: 3

Discode
Discode

Reputation: 1

In case this helps anyone, if you are using a Git repo, make sure the jars make it into the WEB-INF/lib INSIDE the git repo and not just in the project WEB-INF/lib

Upvotes: 0

Vikram Belde
Vikram Belde

Reputation: 1189

From the ToolBar to go Project> Properties>Java Build Path > Add External Jars. Locate the File on the local disk or web Directory and Click Open.

This will automatically add the required Jar files to the Library.

Upvotes: 0

ifti
ifti

Reputation: 669

Check under project properties -> deployment assembly if jar file are under deployed path- WEB-INF/lib if not use add button and add jar under WEB-INF/lib

sometime eclipse (in my case Juno Service Release 2 ) was not doing it for me so i did manually. this worked for me.

Upvotes: 1

G O'Rilla
G O'Rilla

Reputation: 268

Pasting the jar files in WebContent\WEB-INF\lib via the file system was the only way it worked for me.

They then appeared under the Deployed Resources and WebContent lib sub-folders.

When I looked, the build path had the jars in the Web App Libraries and everything built and ran fine.

Upvotes: 3

madhairsilence
madhairsilence

Reputation: 3870

Found a solution. This problem happens, when you import a project.

The solution is simple

  1. Right click -> Properties
  2. Project Facets -> Check Dyanmic Web Module and Java Version
  3. Apply Setting.

Now you should see the web app libraries showing your jars added.

Upvotes: 7

Mike G
Mike G

Reputation: 4793

  • Add the jar file to your WEB-INF/lib folder.
  • Right-click your project in Eclipse, and go to "Build Path > Configure Build Path"
  • Add the "Web App Libraries" library

This will ensure all WEB-INF/lib jars are included on the classpath.

Upvotes: 47

morja
morja

Reputation: 8550

They are automatically added to the project classpath if its a web project. Sometimes it does not work properly, a refresh or close/open of the project helps.

if its not a web project you can right click on the library and go to "Build Path" -> "Add to Build Path"

Upvotes: 2

Related Questions