Take the 2-minute tour ×

I am using this tutorial to set up Tomcat Server. After I have put the HelloServlet.java in classes and Web.xml in the WEB-INF folder and I'm giving the command


On the browser. I'm always getting ClassNotFoundException. If anyone can tell me where am I going wrong.

I'm using JDK1.6.0_30, and Tomcat7 for my sample application.

share|improve this question
add comment

4 Answers

You need to put the compiled HelloServlet.class file (not the .java file) in the WEB-INF/classes folder.

share|improve this answer
add comment

Compile HelloServlet.java and place the output class file HelloServlet.class into

share|improve this answer
add comment

One thing you should check is that, the HelloServlet.class should be in a package. Looks like you have a long way to go with Servlet and JSP... I recommend Head First Servlet and JSP for your reference.

share|improve this answer
add comment

In your 'WEB-INF' of 'classes' folder place the .class files and if your using JDBC, jsp's just Copy the .jar executable files into 'lib' folder. and make sure that xml file should contain the proper information.

you should follow below Web Application Directory Structure WEB-INF/ --

  1. web.xml --xml file
  2. classes/ ---classes folder here we keep .class files Myservlet.class
  3. lib/ ---lib folder here we keep all .jar files. Myapp.jar

    Welcome.html Welcome.jsp

share|improve this answer
add comment

Your Answer


