Hi Sanjeev,
Here i am providing some steps for u. I hope u will succed in running a servlet after following this steps.
Win 95/98/ME Environment
------------------------
open your autoexec.bat file and type the following.
1)set JAVA_HOME=<replace this with your java directory>
2)set TOMCAT_HOME=<replace this with your tomcat directory>
3)set classpath=<tomcat_directory>\lib\servlet.jar;<java_directory>\src.jar;<java_directory>\lib\tools.jar;
After editing the autoexec.bat file, restart your system such that the changes u made to the system in autoexec.bat will take effect to the os.
****************************************************************
Win NT/2000
-----------
Open Control Panel and Select System icon on it.
Here u can set the environment variables for the system.
Double click on the Classpath and add
<tomcat_directory>\lib\servlet.jar;<java_directory>\src.jar;<java_directory>\lib\tools.jar;
the above lines.
In winnt environment there is no need to restart the system.
***************************************************************
After successfully setting up the environment, u have to configure the tomcat server. But for now, to test whether the servlet is running or not, you can follow these steps.
1) Write a servlet.
2) Dont forget to put it in package.
3) This servlet should be placed in <tomcat_directory>\webapps\examples\WEB-INF\classes.
(dont worry, i will tell you how to map your own context instead of </examples> )
So, for example if you wrote a servlet called HelloWorld.java then the directory hierarchy should be as follows.
c:\tomcat\webapps\examples\WEB-INF\classes\Hello\HelloWorld.java
Note: Here Hello is a package name.
4) Compile the servlet from the same directory.
5)After successfully compiling the java file you have to map the servlet in the web.xml file.
Note: web.xml file is located under c:\tomcat\webapps\examples\WEB-INF directory.
6) Edit the file and there u have to type this lines.
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>Hello.HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
7)After making changes in web.xml file restart your tomcat server.
8) In the browser address type:
http://localhost:8080/examples/HelloWorld And thats it, you can find ur servlet running.
I hope u find this info useful.
Bye.
Loke.