Re: Can't compile Servlet file

Carmine Montella <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <000901c37ec9$cfc3ae60$3e03a8c0@openweb>
You need to copy a servlet.jat in a dir Tomcat/common/lib and add this file in your classptah.

Alternative:

javac a1 -classpath c:\path of your servlet.jar

Bye
Carmine
  ----- Original Message ----- 
  From: Edward King 
  To: [email protected] 
  Sent: Friday, September 19, 2003 12:03 AM
  Subject: Can't compile Servlet file


  I use JDK 1.4.1_02 and Tomcat5.0 under Window2000 Server, I have a Servlet file,like follows:

  import javax.servlet.*;
  import javax.servlet.http.*;
  import java.io.*;
  public class a1 extends HttpServlet{
   public void doGet(HttpServletResponse req,HttpServletResponse resp) throws ServletException,IOException{
    PrintWriter pw=resp.getWriter();
    pw.println("<html><body>Hello World!</body></html>");
    pw.close();
   }
  }

  but when I compile it,it raises many errors:

  a1.java:1: package javax.servlet does not exist
  import javax.servlet.*;
  ^
  a1.java:2: package javax.servlet.http does not exist
  import javax.servlet.http.*;
  ^
  a1.java:4: cannot resolve symbol
  symbol  : class HttpServlet
  location: class a1
  public class a1 extends HttpServlet{
                          ^
  a1.java:5: cannot resolve symbol
  symbol  : class HttpServletResponse
  location: class a1
          public void doGet(HttpServletResponse req,HttpServletResponse resp) thro
  ws ServletException,IOException{
                            ^
  a1.java:5: cannot resolve symbol
  symbol  : class HttpServletResponse
  location: class a1
          public void doGet(HttpServletResponse req,HttpServletResponse resp) thro
  ws ServletException,IOException{
                                                    ^
  a1.java:5: cannot resolve symbol
  symbol  : class ServletException
  location: class a1
          public void doGet(HttpServletResponse req,HttpServletResponse resp) thro
  ws ServletException,IOException{

     ^
  6 errors


  I know Java not found package javax.servlet, I remember there is a file "servlet.jar" 
  in Tomcat4 and I guess to put it in java directory,but Tomcat5 didn't have this file.
  How do I to solve this problem?

  Thanks in advance!




  ___________________________________________________________________________ To unsubscribe, send email to [email protected] and include in the body of the message "signoff SERVLET-INTEREST". 
  Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html 


___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.