Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

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?

like image 696
ferz Avatar asked Dec 14 '10 15:12

ferz


People also ask

How do I add a library to my WEB INF?

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.

Why can't I add external JARs in Eclipse?

However, the 'add external jars' button is greyed out, implying that i am not allowed to use it. Can anyone help? If your project builds with Java 9+ make sure you've selected Classpath (as shown here). You should also be able to add the JAR with right-click on the project > Build Path > Add External Archives....

In which folder we can add JAR file?

9 Answers. Show activity on this post. If you're wanting to include a JAR file to your Eclipse project, you would generally create a 'lib' folder inside the project folder, and put the file in there. You then need to tell eclipse to include it in your class path so your code will compile and run inside eclipse.


3 Answers

  • 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.

like image 54
Mike G Avatar answered Oct 11 '22 01:10

Mike G


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.

like image 7
madhairsilence Avatar answered Oct 11 '22 01:10

madhairsilence


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.

like image 3
G O'Rilla Avatar answered Oct 11 '22 01:10

G O'Rilla