View Full Version : Javac not working at coreservlets

03-02-2004, 08:31 PM
I compile my HelloServlet3.java and ServletUtilities.java fine in other directory, but it will not compile in this directory:

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.

03-02-2004, 09:16 PM
are you importing anything into that class that does not reside in that directory?

03-02-2004, 09:24 PM
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)

03-03-2004, 09:59 AM
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).