can't compile simple servlet?

Discussions

Web tier: servlets, JSP, Web frameworks: can't compile simple servlet?

  1. can't compile simple servlet? (2 messages)

    Hello

    I am compiling one simple servlet(HelloWorldExample.java) where certain packages are imported but error messages like
    package javax.servlet does not exist,
    package javax.servlet.http does not exist,
    cannot resolve symbol (symbol : class HttpServlet),etc. is displayed.

    Here is the code:

    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;

    public class HelloWorldExample extends HttpServlet {

        public void doGet(HttpServletRequest request,
                          HttpServletResponse response)
            throws IOException, ServletException
        {
             ................. //other code

    What's wrong?
  2. can't compile simple servlet?[ Go to top ]

    You don't have Servlet.jar in your classpath

    Senthil.
  3. can't compile simple servlet?[ Go to top ]

    Thanks it worked but when tomcat get installed, it should automatically add servlet.jar to classpath.