You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ryan Ford <RF...@XSCITY.com> on 2001/09/07 23:39:01 UTC

servlet.jar

Hello List :)

I have successfully installed the following system:

RedHat 7.1
Apache 1.3.19 (I think - I installed the one that comes with RH dist.)
Tomcat 3.2.3 Binary
Sun JDK 1.3.1 Binary

Everything plays together nicely so far, except I can't seem to compile a
servlet.  From what I'm seeing and what I understand, its somehow not
recognizing my servlet.jar file in $TOMCAT_HOME/lib (even though it sees the
tools.jar among others).  Any help would be much appreciated.

Error Message is:

SimpleServlet.java:1: package javax.servlet does not exist
import javax.servlet.*;
^
SimpleServlet.java:2: package javax.servlet.http does not exist
import javax.servlet.http.*;
^

And then everywhere I make a reference to something in one of those packages
O get a "cannot resolve symbol"


Servlet Code:

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

public class SimpleServlet extends HttpServlet {

	public void init(ServletConfig config)
	  throws ServletException {
		super.init(config);
	}

	public void doGet(HttpServletRequest request,
	  HttpServletResponse response)
	  throws ServletException, IOException {
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();

		out.println("<html>");
		out.println("<head><title>SimpleServlet</title></head>");
		out.println("<body>");

		out.println("Your request method was " + request.getMethod()
		  + "\n");

		out.println("</body></html>");
		out.close();
	}
}

Re: servlet.jar

Posted by Vijaya Kumar <vi...@businex.com>.
        You need to place the servlet.jar file in your classpath. The files
placing inside tomcat will be refered only durin the runtime of the server.
For compilation, you need to set the classpath variable to include
servlet.jar

In windows, you may use  set classpath =
%classpath%;{TOMCAT_HOME}\lib\servlet.jar  I have no idea about RedHat.

Cheers
Vijay

----- Original Message -----
From: "Ryan Ford" <RF...@XSCITY.com>
To: "Tomcat-User (E-mail)" <to...@jakarta.apache.org>
Sent: Saturday, September 08, 2001 3:09 AM
Subject: servlet.jar


> Hello List :)
>
> I have successfully installed the following system:
>
> RedHat 7.1
> Apache 1.3.19 (I think - I installed the one that comes with RH dist.)
> Tomcat 3.2.3 Binary
> Sun JDK 1.3.1 Binary
>
> Everything plays together nicely so far, except I can't seem to compile a
> servlet.  From what I'm seeing and what I understand, its somehow not
> recognizing my servlet.jar file in $TOMCAT_HOME/lib (even though it sees
the
> tools.jar among others).  Any help would be much appreciated.
>
> Error Message is:
>
> SimpleServlet.java:1: package javax.servlet does not exist
> import javax.servlet.*;
> ^
> SimpleServlet.java:2: package javax.servlet.http does not exist
> import javax.servlet.http.*;
> ^
>
> And then everywhere I make a reference to something in one of those
packages
> O get a "cannot resolve symbol"
>
>
> Servlet Code:
>
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.*;
> import java.util.*;
>
> public class SimpleServlet extends HttpServlet {
>
> public void init(ServletConfig config)
>   throws ServletException {
> super.init(config);
> }
>
> public void doGet(HttpServletRequest request,
>   HttpServletResponse response)
>   throws ServletException, IOException {
> response.setContentType("text/html");
> PrintWriter out = response.getWriter();
>
> out.println("<html>");
> out.println("<head><title>SimpleServlet</title></head>");
> out.println("<body>");
>
> out.println("Your request method was " + request.getMethod()
>   + "\n");
>
> out.println("</body></html>");
> out.close();
> }
> }
>