Save the servlet file in the following path: D:\Program Files\Apache Group\Tomcat4.1\Web-apps\examples\Web-Inf\classes Open command prompt and get the prompt at the following path: D:\Program Files\Apache Group\Tomcat4.1\Web-apps\examples\Web-Inf\classes> Set the classpath: D:\Program Files\Apache Group\Tomcat4.1\Web-apps\examples\Web-Inf\classes> set classpath=%classpath%; d:\Program Files\Apache Group\Tomcat4.1\common\lib\servlet.jar; Compile the servlet program: D:\Program Files\Apache Group\Tomcat4.1\Web-apps\examples\Web-Inf\classes> javac servlet file name.java Run Tomcat Execute the servlet file: Open the browser and enter the following: http://localhost: 8080/examples\servlet\name of the servlet program(without .java extension)