In order to write servlets code I need servlet-api.jar. Where do i get servlet-api.jar from ?
4 Answers
Make sure that you're using the same Servlet API specification that your Web container supports. Refer to this chart if you're using Tomcat: http://tomcat.apache.org/whichversion.html
The Web container that you use will definitely have the API jars you require.
Tomcat 6 for example has it in apache-tomcat-6.0.26/lib/servlet-api.jar
- 16,730
- 13
- 70
- 94
-
7For those with Tomcat 7, you'll probably find the lib directory in /usr/share/tomcat7/lib – jsaven Jan 15 '13 at 10:38
Grab it from here
Just choose required version and click 'Binary'. e.g direct link to version 2.5
- 2,067
- 16
- 25
-
This should get the checkmark if you just want the jar, no muss no fuss. Awesome! – Jan 14 '14 at 01:21
You may want to consider using Java EE, which includes the javax.servlet.* packages. If you require a specific version of the servlet api, for instance to target a specific web application server, you will probably want the Java EE version which matches, see this version table.
- 1,757
- 13
- 17
You can find a recent servlet-api.jar in Tomcat 6 or 7 lib directory. If you don't have Tomcat on your machine, download the binary distribution of version 6 or 7 from http://tomcat.apache.org/download-70.cgi
- 14,032
- 3
- 33
- 26