In the past I did not have to deal with packages. Now I do and need you help please.
The class path is set as follows in autoexec.bat:
set PATH=%PATH%;F:\j2sdk1.5.0\bin
set JAVA_HOME=F:\j2sdk1.5.0
set CATALINA_HOME=F:\Tomcat5
set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\common\lib\servlet-api.jar
cd %CATALINA_HOME%\webapps\ATS\ WEB-INF\classes\wrox
Both my classes are in the wrox directory and one of them refers the other. When I run (at the command prompt F:\Tomcat5\webapps\ATS\WEB-INF\classes\wrox javac HelloWWW3.java) the one that refers the other both of them should be compiled automatically but instead I get an error:
Cannot find symbol variable ServletUtilities
Location wrox.HelloWWW3
out.println(ServletUtilities.headWithTitle(title)
HelloWWW3:
package wrox;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWWW3 extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Hello WWW again";
out.println(ServletUtilities.headWithTitle(title) +
"<BODY>\n" +
"<H1>Hello WWW</H1>\n" +
"</BODY></HTML>");
}
}
ServletUtilities:
package wrox;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletUtilities
{
public static final String DOCTYPE =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">";
public static String headWithTitle(String title)
{
return(DOCTYPE + "\n" +
"<HTML>\n" +
"<HEAD><TITLE>" + title + "</TITLE></HEAD>\n");
}
}
Please note that I have no difficulty compiling code that does not refer to a custom class. For example I was able to run ServletUtilites and it did compile with no problem. Your help is very much appreciated.
Maru