Results 1 to 6 of 6

Thread: Need Help with compiling Servlet [Resolved]

  1. #1

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Need Help with compiling Servlet [Resolved]

    Hi,
    I am just trying to compile few servlets but dont really know how to set up JDK so that it can find the Servlet APIs. I am using JDK 1.3 and running JavaWeb Server 2.0. I have copied all the jar files to the JDK lib folder. Still i get error message when compiling ServLet files.

    Can anyone tell me how can i point the Java Compiler to the Servlet APIs, thanks a lot for any help.

    Danial

    PS : I get the following error message

    HelloWorldServlet.java:26: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    HelloWorldServlet.java:27: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    HelloWorldServlet.java:36: cannot resolve symbol
    symbol : class HttpServlet
    location: class sunexamples.HelloWorldServlet
    class HelloWorldServlet extends HttpServlet {
    ^
    HelloWorldServlet.java:38: cannot resolve symbol
    symbol : class HttpServletRequest
    location: class sunexamples.HelloWorldServlet
    public void doGet (HttpServletRequest req, HttpServletResponse res)
    ^
    HelloWorldServlet.java:38: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class sunexamples.HelloWorldServlet
    public void doGet (HttpServletRequest req, HttpServletResponse res)
    ^
    HelloWorldServlet.java:39: cannot resolve symbol
    symbol : class ServletException
    location: class sunexamples.HelloWorldServlet
    throws ServletException, IOException
    ^
    6 errors
    Last edited by Danial; Nov 20th, 2001 at 03:13 PM.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    I am using JDK 1.3 and running JavaWeb Server 2.0.
    I know nothing about JavaWeb Server 2.0 but, where are you compiling your HelloWorld servlet from? Im pretty sure that you have to set the CLASSPATH environment variable in your autoexec.bat so your classes can be found. That's all i can think of.

  3. #3

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Thanks Dilenger for replying, i have tried copiling the .java files from different location without any success. I have even copied it to the JDK bin folder and then tried to compile but it still cant find the Servlet classes/APIs(.jar files i think). Where should be the API/Class located. I have copied them to the JDK Lib directory. I have jdk/bin in my CLASSPATH.

    Any ideas?

    Thanks again
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Well, do you have a jar file called servlet.jar? That is the one I have for servlets. You must specifically list <path to bin directory>\servlet.jar in your CLASSPATH in order for the classes to be found.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Hi crptcblade,
    Thanks for your reply, Yes i have added the servlet.jar path to the CLASSPATH as you recommended, but i still get the same error message. Where did you place your .jar files. JDK bin folder ? What am i doing wrong? Can you plz tell me how you installed the Servlet APIs and how you compile a servlet file.

    Thanks a lot

    Below is a print screen shot of my PATH

    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  6. #6

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Hi,
    I have figured it out. I found out that in win2k and XP you have two path 1. PATH 2. CLASSPATH. You need to add the servlet.jar file to the 2nd CLASSPATH then it works!!

    Thanks anyway.

    Danial
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

Posting Permissions

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



Click Here to Expand Forum to Full Width