Results 1 to 3 of 3
  1. #1
    sini.sep87 is offline Member
    Join Date
    Nov 2009
    Posts
    10
    Rep Power
    0

    Default cannot find symbol httpservlet

    C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\myfirstapp\WEB-IN
    F\Source>javac -d ../classes *.java
    FirstServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    FirstServlet.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    FirstServlet.java:6: cannot find symbol
    symbol: class HttpServlet
    public class FirstServlet extends HttpServlet
    ^
    FirstServlet.java:8: cannot find symbol
    symbol : class HttpServletRequest
    location: class FirstServlet
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws
    IOException
    ^
    FirstServlet.java:8: cannot find symbol
    symbol : class HttpServletResponse
    location: class FirstServlet
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws
    IOException
    ^
    5 errors

    Hi... pls help me out... am not able the java file.. code is given here,


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


    public class FirstServlet extends HttpServlet
    {
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException
    {
    System.out.println("Inside doget method");
    try{
    PrintWriter out = res.getWriter();
    out.println("HELLO WORLD!!!");
    }
    catch(IOException e)
    {
    e.printStackTrace();
    }
    }
    }


    Classpath is set to C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib

    stil am gettin the above errors

  2. #2
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    282
    Rep Power
    6

    Default

    classpath should be set to

    C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar

    and please use code tags while pasting codes.

  3. #3
    sini.sep87 is offline Member
    Join Date
    Nov 2009
    Posts
    10
    Rep Power
    0

Similar Threads

  1. cannot find symbol constructor
    By daud in forum New To Java
    Replies: 9
    Last Post: 08-13-2009, 03:53 AM
  2. cannot find symbol
    By GabWit in forum New To Java
    Replies: 3
    Last Post: 01-25-2009, 12:13 AM
  3. Replies: 9
    Last Post: 10-18-2008, 08:26 PM
  4. Replies: 3
    Last Post: 05-01-2008, 08:30 AM
  5. Error: cannot find symbol
    By cachi in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 08:12 PM

Posting Permissions

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