Results 1 to 3 of 3
  1. #1
    junaidsherief is offline Member
    Join Date
    Sep 2010
    Posts
    1
    Rep Power
    0

    Default javax.servet.* does not exist

    following is the tomcat folder
    E:\java tools\apache-tomcat-6.0.29-windows-x86\apache-tomcat-6.0.2900

    http:/localhost:8080 - shows tomcat default page(after running bin\startup.bat)

    but I cannot compile the followin code - javax.servlet does not exist

    import java.io.*;
    import java.servlet.*;
    import javax.servlet.*;

    public class HelloWorld extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<body>");
    out.println("<head>");
    out.println("<title>Hello World!</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Hello World!</h1>");
    out.println("</body>");
    out.println("</html>");
    }
    }

    what went wrong - java programs working from my system

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,809
    Rep Power
    19

    Default

    You need to include the servlet.jar in your compilation path.

  3. #3
    67726e is offline Member
    Join Date
    Mar 2010
    Location
    Hilton Head, SC
    Posts
    34
    Rep Power
    0

    Default

    The location of the 'Servlet.jar' is [Tomcat Root]\lib\servlet-api.jar

    At least that is how it is on my computer. I'm assuming you are compiling by command line so you would need to write:

    set classpath=[Tomcat Root]\lib\servlet-api.jar

    You should then be able to compile your servlet.

Similar Threads

  1. package javax.servlet does not exist :>
    By wildheart25c in forum Java Servlet
    Replies: 2
    Last Post: 02-17-2010, 12:02 AM
  2. HttpClientLibrary does not exist
    By gbose in forum Networking
    Replies: 1
    Last Post: 02-03-2010, 07:21 PM
  3. javax.microedition.io/ javax.bluetooth
    By ahtiven in forum New To Java
    Replies: 3
    Last Post: 01-13-2009, 02:54 PM
  4. package javax.servlet does not exist
    By nikhil2jan in forum Java Servlet
    Replies: 1
    Last Post: 01-04-2009, 04:32 PM
  5. How to call method in servet by using JSP?
    By frankjava1 in forum Java Servlet
    Replies: 2
    Last Post: 10-24-2008, 04:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •