Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I get servlet-api.jar from?

Tags:

servlets

In order to write servlets code I need servlet-api.jar. Where do i get servlet-api.jar from ?

like image 700
oneiros Avatar asked Dec 15 '11 14:12

oneiros


People also ask

What is the location of servlet API jar file?

For Eclipse user, when you run a servlet (right click on the servlet . java file and select Run as > Run on Server ), Eclipse automatically compiles the file before running it. To manually compile a Java servlet, you may need to set a classpath to include servlet-api. jar (presumably in apache-tomcat/lib/ folder).

What JAR files are required for servlets?

You need Servlet-api. jar to compile servlets in eclipse but while deploying servlet container ( like tomcat ) will have it built in.

Where do I put servlet API in eclipse?

For adding a jar file, right click on your project -> Build Path -> Configure Build Path -> click on Libraries tab in Java Build Path -> click on Add External JARs button -> select the servlet-api. jar file under tomcat/lib -> ok. Now servlet has been created, Let's write the first servlet code.

What is the use of servlet API jar?

What is it? The servlet-api jar is a library which contains the interfaces and classes of the Servlet API specification. The servlet-api jar contains only the interface (the API) of the Servlet Specification, so you can use it to develop your web application.


1 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

like image 84
Oleg Mikheev Avatar answered Oct 06 '22 02:10

Oleg Mikheev