I was trying to run a servlet program in Tomcat. I placed the compiled a.class file in the directory of WEBAPP/ROOT/WEB-INF/classes, however when I try to run http://localhost/servlet/a, Tomcat can't find the file. How should I set up the Tomcat so that this will work. Thanks in advance.
Since version 4.1 Tomcat doesn't support calling servlets using their fully qualified classname. So I think you'll be forced to modified the web.xml file located in the web-inf directory of your web application. ex :
The url used to call you servlet should be something like http://127.0.0.1:8080/Hello if the webapp where your servlet is deployed is the ROOT webapp of tomcat else the url will be <a href="http://127.0.0.1:8080/<i rel="nofollow">webappname</i>/Hello" target="_blank">http://127.0.0.1:8080/webappname/Hello Hope it helps Nicolas
<a href="http://www.javablackbelt.com/?utm_source=javaranch&utm_medium=signature&utm_campaign=Forum%2BBuzz" target="_blank" rel="nofollow">BlackBeltFactory Communtiy</a> founder - Building better developers<br /><b>Free</b> courses and mock exams