title: HTTP Status Code 404 Java/Servlets
body: <p>Even though I found several similar questions I'm not able to create my first <code>Hello World</code> Servlet.  I keep receiving status code 404.</p>
  
  <p>So in the following folder <code>/home/smihai/apache-tomcat-7.0.52/webapps/HelloWorld/WEB-INF/</code> I have a <strong>web.xml</strong> file and another folder "classes" with 2 files: <strong>HelloWorld.java</strong> and <strong>HelloWorld.class</strong>.</p>
  
  <p>The web.xml file contains:</p>
  
  <pre><code>&lt;web-app&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;HelloWorld&lt;/servlet-name&gt;
          &lt;servlet-class&gt;HelloWorld&lt;/servlet-class&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;HelloWorld&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/HelloWorld&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>The HelloWorld.java contains:</p>
  
  <pre><code>import java.io.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  public class HelloWorld extends HttpServlet{ 
      public void doGet(HttpServletRequest request, HttpServletResponse response)
                                     throws ServletException,IOException{
          response.setContentType("text/html");
          PrintWriter pw = response.getWriter();
          pw.println("&lt;html&gt;");
          pw.println("&lt;head&gt;&lt;title&gt;Hello World&lt;/title&gt;&lt;/title&gt;");
          pw.println("&lt;body&gt;");
          pw.println("&lt;h1&gt;Hello World&lt;/h1&gt;");
          pw.println("&lt;/body&gt;&lt;/html&gt;");
      }
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>