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

public class HelloWorld 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 ("<body>");
          out.println ("<head>");
          out.println ("<title>Hello World!</title>");
          out.println ("</head>");
          out.println ("<h1>Hello World!</h1>");
          out.println ("</body>");
          out.println ("</html>");
     }
}


On trying to compile this servlet program, I get the error message, "package
javax.servlet does not exist".

On compiling the same program using this command "$javac -classpath
/usr/local/tomcat-4.0.1/common/lib/servlet.jar HelloWorld.java" there are no
errors.

Does the compilation of the servlet depend on setting up the proper context in
the server.xml file???

Thanks in advance,

Samarth







"Craig R. McClanahan" <[EMAIL PROTECTED]> on 01/10/2002 05:13:29 PM
> The other is also in the same document in the section discussing the order in
> which the class or resource loader looks for the various classes.
> $CATALINA_HOME/common/classes or $CATALINA_HOME/common do not contain any jar
> files, but the jars are present in $CATALINA_HOME/common/lib.  I was wondering
> if we need to copy all the files from the $CATALINA_HOME/common/lib directory
to
> either the $CATALINA_HOME/common/classes directory or to the
> $CATALINA_HOME/common directory.
>

That's another typo -- that entry should really be:

  $CATALINA_HOME/common/lib/*.jar

> I found this out when I was trying to compile the "HelloWorld" servlet example
> and kept on getting the "class not found error" again and again.
>
> Any pointers on this will be helpful.
>
> Thanks in advance,
>
> Samarth
>

I will check in the documentation fixes today.  Thanks!

Craig




--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to