You need to add tomcat/lib/servlet.jar to your CLASSPATH.

(BTW, you can always find out what classes are in any JAR file by running
"jar -tf" on the file.)


                                                            -- Bill K.


> -----Original Message-----
> From: Mick Sullivan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 22, 2001 5:27 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Question on import javax.servlet.*;???
> 
> 
> Nice one (Again) for the reply Craig,
> The problem is the code I sent was just me messing around 
> seeing what would 
> happen if I took out the 'x', but I forgot to put it back in 
> when I was 
> copying the code.
> Here it is again:
> 
> SOURCE:
> package login;
> 
> import java.util.*;
> import java.sql.*;
> import java.io.*;
> import java.lang.*;
> import javax.servlet.*
> import javax.servlet.http.*,
> 
> ERROR:
> c:\tomcat\webapps\projectUser\web-inf\classes\loginHandler.jav
> a:8: Package 
> javax
> .servlet not found in import.
> import javax.servlet.*;
>        ^
> c:\tomcat\webapps\projectUser\web-inf\classes\loginHandler.jav
> a:9: Package 
> javax
> .servlet.http not found in import.
> import javax.servlet.http.*;
>        ^
> 2 errors
> 
> 
> Therefore I assume the problem is to do with the classpath.
> The file 'servlet.jar' is located in my
> c:\tomcat\lib   folder   and also in
> c:\tomcat\lib\common  folder
> I also have the folder 'tomcat-servletapi-3.2' in the root 
> directory of my c 
> drive. Might the problem have something to do with this?
> 
> I know Ive been at this for bout 6 months now, but what do 
> you mean when you 
> say "'servlet.jar' should be located in the classpath"?
> I compile my files using DOS and the javac command.
> My JDK is located in c:\Jbuilder35\jdk1.2.2\bin
> I do not use JBuilder to write my beans, I use homesite, an 
> HTML editor that 
> also allows .java files. Do I have to move the server.jar 
> file somewhere 
> into the JDK folder or something? As you can probably tell Im kinda 
> clueless, even still my projects nearly there, if I can just 
> sort out this 
> login stuff. Yopur help is much appreciated.
> 
> Thanks again,
> Mick
> 
> 
> 
> ----Original Message Follows----
> From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: Re: Question on import javax.servlet.*;???
> Date: Thu, 22 Mar 2001 14:15:31 -0800 (PST)
> 
> 
> 
> On Thu, 22 Mar 2001, Mick Sullivan wrote:
> 
>  > Hi
>  > Does anyone know why I get the following error when I try to import
>  > "import javax.servlet.*;  AND
>  > import javax.servlet.http.*;"
>  > I need them for my loginHandler to use sendRedirect etc.
>  > This is the error:
>  >
>  > C:\JBuilder35\jdk1.2.2\bin>javac
>  > c:\tomcat\webapps\projectuser\web-inf\classes\l
>  > oginHandler.java
>  > c:\tomcat\webapps\projectuser\web-inf\classes\loginHandler.java:7: 
> Package
>  > java.
>  > servlet not found in import.
>  > import java.servlet.*;
>  >        ^
>  > c:\tomcat\webapps\projectuser\web-inf\classes\loginHandler.java:8: 
> Package
>  > java.
>  > servlet.http not found in import.
>  > import java.servlet.http.*;
>  >
>  > Anyone have any ideas? The answer is probably straight 
> forward (as usual)
> 
> Yep :-).  It's javax.servlet.* and javax.servlet.http.*, not 
> java.servlet
> and java.servlet.http (note the "x").
> 
> When you compile, you will need to make sure that the servlet.jar file
> from your servlet container is on the compiler's classpath.
> 
>  > Thanks in advance,
>  > Mick
>  >
> 
> Craig McClanahan
> 
> 
> ______________________________________________________________
> ___________
> Get Your Private, Free E-mail from MSN Hotmail at 
http://www.hotmail.com.

Reply via email to