Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2003
    Location
    Canada, Ontario, Mississauga
    Posts
    312
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javac not working at coreservlets

    I compile my HelloServlet3.java and ServletUtilities.java fine in other directory, but it will not compile in this directory:
    /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/coreservlets

    It gave me this error:
    [root@localhost coreservlets]# javac HelloServlet3.java
    HelloServlet3.java:23: cannot resolve symbol
    symbol : variable ServletUtilities
    location: class coreservlets.HelloServlet3
    out.println(ServletUtilities.headWithTitle(title) +
    ^
    1 error

    It is not the code error because it works on other directory.

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    are you importing anything into that class that does not reside in that directory?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Regular Coder
    Join Date
    Apr 2003
    Location
    Canada, Ontario, Mississauga
    Posts
    312
    Thanks
    0
    Thanked 0 Times in 0 Posts
    both HelloServlet3.java and ServletUtilities.java are in the same diretory,


    HelloServlet3.java =>
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;

    ServletUtilities.java =>
    import javax.servlet.*;
    import javax.servlet.http.*;

    The error saying HelloServlet3 doesn't know where the method ServletUtilities.headWithTitle("string") . So, it doesn't know where the ServletUtilities.class is to.

    my CLASSPATH conatins the . (current dir)

  • #4
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you're compiling directly from the directory that contains those two files, then it will have problems because they are declared to be in a package called coreservlets, so it will look for them in a subdirectory called coreservlets. So you should compile from the directory that contains the coreservlets subdirectory (the root source directory).

    shmoove


  •  

    Posting Permissions

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