Servlets aren't executed like "normal" Java programs that have a
main() function. Rather, they are bundled into a web application that is then executed by a servlet contains such as
Tomcat, Webshpere, Glassfish, and so on.
If you need to write and execute a servlet, these are concept that you will need to learn. I recommend picking up a good book (Head First Servlets and
JSP one is popular) and prepare to learn a lot.
On the other hand, based upon what you say you are trying to accomplish, I think you may be heading down the wrong path thinking that you need a servlet.
Can you expand on your actual goal?