How can I add JAR files to the web-inf/lib folder in Eclipse?
- 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.
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"
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.
Found a solution. This problem happens, when you import a project.
The solution is simple
- Right click -> Properties
- Project Facets -> Check Dyanmic Web Module and Java Version
- Apply Setting.
Now you should see the web app libraries showing your jars added.