Managing Java Libs with Eclipse
Well I spend a bit of time figuring out how to add libraries to eclispe and finding the tomcat servlet libraries.
First I'll give the location of some key Tomcat jars
- $CATALINA_HOME/common/lib - required
- $CATALINA_HOME/server/lib - nice to have
If eclipse is having trouble resolving javax.servlet.HttpServletRequest or javax.servlet.HttpServletResponse you only need one library
$CATALINA_HOME/common/lib/servlet-api.jar
- Right click on the top level project folder
- Click on "Build Path"
- Click on "Configure Build Path"
- A window pops up, in the dialog box pick the "Libraries" tab
- click on "Add Library"
- Another window pops up with a dialog box, select "User Libraries" and click next
- The infocus window changes showing the existing libraries
- click on "User Libraries"
- The infocus window changes again, select "New"
- enter the name of your library
- Now select your new library and select "Add Jars"
- go add your jars
I have two libraries, one for my local jars under WEB-INF/lib and one for the Tomcat common jars.