Results 1 to 4 of 4
  1. #1
    Join Date
    May 2008
    Posts
    7
    Rep Power
    0

    Default help me to set classpath

    I am new to java .
    i have tomcat 5.5.

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


    public class SecondEx 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("<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>");
    }

    when i am trying to excute this program i got errors like


    package javax.servlet does not exist

    package javax.servlet.http does not exist

    cannot find symbol class HttpServletRequest
    cannot find symbol class HttpServletResponse
    cannot find symbol class ServletException

    could any body help me to fix this errors.

    i have tried classpaths like

    CLASSPATH :C:\Program Files\Apache Software Foundation\Tomcat 5.5\server\lib

    and

    C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib

    but it did n0t work.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default


    Yep, class path error.

    Try this on the command prompt from the working folder.

    Java Code:
    set classpath=c:\Program Files\Apache Software Foundation\Tomcat 5.5\lib\servlet.jar

  3. #3
    Manas Das is offline Member
    Join Date
    Jan 2009
    Posts
    8
    Rep Power
    0

    Default Greetings

    Hello Java Forum.
    Can u help me find the javax.servlet package in jdk1.6

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    The servlet related packages are part of Tomcat. Rather than fussing with the classpath, put JAR files in /common/lib. These JAR's are automatically added to the application classpath. Note that Tomcat separates the server from the applications, which is why you may need to copy some of its JAR's.

    I don't remember the names of the JAR's...

Similar Threads

  1. Classpath
    By Preethi in forum New To Java
    Replies: 5
    Last Post: 06-20-2008, 10:00 AM
  2. Set classPath?
    By rgbosque in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 03:14 PM
  3. GNU Classpath 0.96.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-01-2007, 05:14 PM
  4. GNU Classpath 0.96
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 10-16-2007, 07:35 PM
  5. Doubt with classpath
    By fred in forum New To Java
    Replies: 1
    Last Post: 07-24-2007, 02:58 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
  •