You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ann patil <pa...@hotmail.com> on 2000/09/13 18:13:33 UTC

Problem compiling servlets

Hi! Can anybody please help me,

       I am having problems compiling the servlets.


Steps:
1) In the server.xml I added the following code:
  <Context path="/mytest" docBase="webapps/mytest"
     defaultSessionTimeOut="30" isWARExpanded="true"
               isWARValidated="false" isInvokerEnabled="true"
               isWorkDirPersistent="false"/>

2) In the web.xml I added the following code:
  <servlet>
       <servlet-name>
           hello
       </servlet-name>
       <servlet-class>
           hello
       </servlet-class>
   </servlet>

3) Created a directory mytest under /webapps.

4) Created a subdirectory web-inf/classes under /mytest.

5) Created servlet : hello.java

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

  public class hello extends HttpServlet
  {
         public void doGet(HttpServletRequest request,
                   HttpServletResponse response)
                   throws IOException, ServletException
         {
                response.setContentType("text/html");
                PrintWriter out = response.getWriter();
                out.println("<html><head>");
                out.println("<title>Servlet Test</title>");
                out.println("</head><body>");
                out.println("Hello! Visit the ");
out.println("<a href=\"http://internet.about.com\">");
                out.println("About.com Internet Site</a>");
                out.println("</body>");
                out.println("</html>");
         }
   }

6) Copied hello.java in \webapps\mytest\web-inf\classes directory.

7) From 'Tomcat' home directory ie. c:\local\tomcat> issued command
javac c:\local\tomcat\webapps\mytest\web-inf\classes\hello.java

8) Result : 7 errors
One of which is:

symbol: Class HttpServlet
location: class hello
public class hello extends HttpServlet
                          ^
c:\local\tomcat\webapps\mytest\web-inf\classes\hello.java :7 cannot resolve 
symbol.

Note:
1) I have jdk1.3 on my system.
2) Have no problem starting tomcat.
3) My autoexec.bat looks this:

File: Autoexec.bat

set path=%path%;c:\jdk1.3\bin;c:\jdk1.3\lib;c:\jdk1.3\tools.jar
set classpath=.;c:\jdk1.3\bin;c:\jdk1.3\lib;c:\jdk1.3\tools.jar%CLASSPATH%
set path=%path%;.;c:\local\tomcat;c:\local\tomcat\lib;c:\local\tomcat\bin
;c:\local\tomcat\src;c:\local\tomcat\conf;c:\local\tomcat\logs;c:\local\tomcat\work;c:\local\tomcat\docs;c:\local\tomcat\webapps;c:\local\tomcat\apachedll

set classpath=.;c:\local\tomcat;c:\local\tomcat\lib;c:\local\tomcat\bin
;c:\local\tomcat\src;c:\local\tomcat\conf;c:\local\tomcat\logs;c:\local\tomcat\work;c:\local\tomcat\docs;c:\local\tomcat\webapps;c:\local\tomcat\apachedll;c:\local\tomcat\lib\servlet.jar;c:\local\tomcat\webserver.jar;c:\local\tomcat\jasper.jar;c:\local\tomcat\xml.jar;c:\local\tomcat\ant.jar;c:\local\tomcat\classes%CLASSPATH%



Do I need to make some additional enteries or can somebody help me to trace 
the problem.

Thanks

Ann.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.


Re: Problem compiling servlets

Posted by Nick Bauman <ni...@cortexity.com>.
On Wed, 13 Sep 2000, ann patil wrote:

> 
> 4) Created a subdirectory web-inf/classes under /mytest.

Try WEB-INF
 
(as in META-INF in a jar file)