Monthly Archives: March 2011

Instantiation of Tomcat 6.0 & Running Servlet

Minimum requirement: JDK 1.6 & Standard Browser.

1. Download Apache Tomcat form : & extract the Zip file

2. Environment variable:
a. CATALINA_HOME H:\Software\apache-tomcat-6.0
b. JAVA_HOME C:\Program Files\Java\jdk1.7.0
c. PATH H:\Software\apache-tomcat-6.0\bin
d. Classpath H:\Software\apache-tomcat-6.0\lib\servlet-api.jar; H:\Software\apache-tomcat-6.0\lib\jsp-api.jar

3. Modify this file:


4. cmd => startup or shutdown

4.1 cmd => startup

5. http://localhost:8080

Running Servlet in Tomcat

Simple Application (Servlet):

1. Create a folder inside the webapps (vinod)


2. Create a folder inside vinod => WEB-INF (H:\Software\apache-tomcat-6.0\webapps\vinod\WEB-INF)

3. Create the web.xml file inside WEB-INF (H:\Software\apache-tomcat-6.0\webapps\vinod\WEB-INF\web.xml)



4. Create a folder inside the WEB-INF (Classes)
=> H:\Software\apache-tomcat-6.0\webapps\vinod\WEB-INF\classes

5. Create the Java File inside the WEB-INF => H:\Software\apache-tomcat-6.0\webapps\vinod\WEB-INF\classes

import javax.servlet.*;
import javax.servlet.http.*;

public class First_Class_File extends HttpServlet
public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
PrintWriter out=response.getWriter();

out.println(“Hello Servlet”);


6. Compile the Java file and store
7. http://localhost:8080/vinod/first

Leave a comment

Filed under Servlet & JSP