Here we are sending you a link where you can know about how to configure tomcat for running servlet.http://www.roseindia.net/servlets/HowToRunAServlet.shtml
After configuring servlet API path to compile the Servlet path follow the following steps.
1. Open command prompt(Start -> Run ) and type cmd + (Enter Key)
2. Change the directory to the Servlet file(i.e .java) and
3. type javac to compile the servlet file and if you have defined the package then compile it with the command as :
javac -d . ServletFileName.java
4. Now Place that ServletFileName.class file into your project's "web-inf/classes" directory.