You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shaolin <sh...@gmail.com> on 2009/02/02 15:29:38 UTC

package javax.servlet does not exist import javax.servlet.* ;

Hi Guys

The servlet jars cannot be found. I checked the tomcat lib dir and it was
present and it looks like its something to do with the classpath. How can I
change/update it so that it will work ? Im on a windows

Re: package javax.servlet does not exist import javax.servlet.* ;

Posted by Steve Ochani <oc...@ncc.edu>.
On 2 Feb 2009 at 18:36, Shaolin wrote:

Send reply to:	Tomcat Users List <us...@tomcat.apache.org>
Date sent:	Mon, 02 Feb 2009 18:36:04 +0000
Subject:	Re: package javax.servlet does not exist import javax.servlet.* ;
From:	Shaolin <sh...@gmail.com>
To:	Tomcat Users List <us...@tomcat.apache.org>

> It worked, but how comes I have to use classpath now and not when I
> used to
> do it before ? 

Two different problems. Running tomcat is different from compiling a java servlet application.

It is not recommended to set a systemwide classpath, period.


>is there any way of overcoming this ? Typing up CPs'
> in
> command line takes too much time.
> 

Like Charles pointed out in his reply, use ANT or IDE.

I've used batch and bash scripts also, something like


javac -cp .:/path-to-tomcat/lib/servlet-api.jar:/path-to-additional-jars $1

where $1 is commandline parameter which would be the source file



-Steve O.





> 2009/2/2 Caldarale, Charles R <Ch...@unisys.com>
> 
> > > From: Shaolin [mailto:shaolinfinest@gmail.com]
> > > Subject: Re: package javax.servlet does not exist import
> > > javax.servlet.* ;
> > >
> > > > You'll need to tell javac (or whatever IDE you're
> > > > using) where the servlet-api.jar is.
> > >
> > > How do I do that ?
> >
> > For javac, use the -cp parameter; for any IDE, you'll have to
> consult its
> > documentation.
> >
> >  - Chuck
> >
> >
> > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
> PROPRIETARY
> > MATERIAL and is thus for use only by the intended recipient. If
> you received
> > this in error, please contact the sender and delete the e-mail and
> its
> > attachments from all computers.
> >
> >
> --------------------------------------------------------------------
> -
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: package javax.servlet does not exist import javax.servlet.* ;

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Shaolin [mailto:shaolinfinest@gmail.com]
> Subject: Re: package javax.servlet does not exist import
> javax.servlet.* ;
>
> It worked, but how comes I have to use classpath now and not
> when I used to do it before ?

Before what?

> is there any way of overcoming this ? Typing up CPs' in
> command line takes too much time.

Which is why people normally use ant scripts (or IDEs) to build their products with.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: package javax.servlet does not exist import javax.servlet.* ;

Posted by Shaolin <sh...@gmail.com>.
It worked, but how comes I have to use classpath now and not when I used to
do it before ? is there any way of overcoming this ? Typing up CPs' in
command line takes too much time.

2009/2/2 Caldarale, Charles R <Ch...@unisys.com>

> > From: Shaolin [mailto:shaolinfinest@gmail.com]
> > Subject: Re: package javax.servlet does not exist import
> > javax.servlet.* ;
> >
> > > You'll need to tell javac (or whatever IDE you're
> > > using) where the servlet-api.jar is.
> >
> > How do I do that ?
>
> For javac, use the -cp parameter; for any IDE, you'll have to consult its
> documentation.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: package javax.servlet does not exist import javax.servlet.* ;

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Shaolin [mailto:shaolinfinest@gmail.com]
> Subject: Re: package javax.servlet does not exist import
> javax.servlet.* ;
>
> > You'll need to tell javac (or whatever IDE you're
> > using) where the servlet-api.jar is.
>
> How do I do that ?

For javac, use the -cp parameter; for any IDE, you'll have to consult its documentation.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: package javax.servlet does not exist import javax.servlet.* ;

Posted by Gregor Schneider <rc...@googlemail.com>.
if you're compiling from the console-window:

javac -help

take a look at "-classpath"

if you're using an ide, check out your ide's documentation

rgds

gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: package javax.servlet does not exist import javax.servlet.* ;

Posted by Shaolin <sh...@gmail.com>.
Thanks - Im using the exe version and replaced the tomcat6 and tomcat6w
versions with the 64 bit ones. I tried it with another app of mine that
works but it wouldnt compile that one either.

> You'll need to tell javac (or whatever IDE you're using) where the
servlet-api.jar is.

How do I do that ?




2009/2/2 Caldarale, Charles R <Ch...@unisys.com>

> > From: Shaolin [mailto:shaolinfinest@gmail.com]
> > Subject: Re: package javax.servlet does not exist import
> > javax.servlet.* ;
> >
> > 1. Im using 6.0.18 64 bit with windows xp 64  and Java SDK SE
> > 6 update 11 (64bit).
>
> Did you install Tomcat from the .exe download or the .zip one?  You will
> need the 64-bit versions of tomcat6.exe and tomcat6w.exe if you want to run
> Tomcat as a service.  I would recommend running it from the command line
> using the startup.bat and shutdown.bat scripts (from the .zip downloads)
> until you get the bugs worked out.  After that, get the 64-bit versions
> here:
> http://svn.apache.org/viewvc/tomcat/connectors/trunk/procrun/bin/amd64/
>
> Rename them, changing the 5 to 6.
>
> > 3. The servlet-api jar is in the tomcat lib dir and not in app lib dir
> > 4. Didnt find the j2ee jar in the tomcat folder.
>
> Do the servlet and JSP examples that come with Tomcat work?  If so, and
> it's just your webapp that's failing with the package does not exist error,
> then something is odd with your webapp.
>
> It just struck me: this is a compilation message, not a run-time one.
>  You'll need to tell javac (or whatever IDE you're using) where the
> servlet-api.jar is.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: package javax.servlet does not exist import javax.servlet.* ;

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Shaolin [mailto:shaolinfinest@gmail.com]
> Subject: Re: package javax.servlet does not exist import
> javax.servlet.* ;
>
> 1. Im using 6.0.18 64 bit with windows xp 64  and Java SDK SE
> 6 update 11 (64bit).

Did you install Tomcat from the .exe download or the .zip one?  You will need the 64-bit versions of tomcat6.exe and tomcat6w.exe if you want to run Tomcat as a service.  I would recommend running it from the command line using the startup.bat and shutdown.bat scripts (from the .zip downloads) until you get the bugs worked out.  After that, get the 64-bit versions here:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/procrun/bin/amd64/

Rename them, changing the 5 to 6.

> 3. The servlet-api jar is in the tomcat lib dir and not in app lib dir
> 4. Didnt find the j2ee jar in the tomcat folder.

Do the servlet and JSP examples that come with Tomcat work?  If so, and it's just your webapp that's failing with the package does not exist error, then something is odd with your webapp.

It just struck me: this is a compilation message, not a run-time one.  You'll need to tell javac (or whatever IDE you're using) where the servlet-api.jar is.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: package javax.servlet does not exist import javax.servlet.* ;

Posted by Shaolin <sh...@gmail.com>.
1. Im using 6.0.18 64 bit with windows xp 64  and Java SDK SE 6 update 11
(64bit).
2. I did do it just afew moments ago to see if it would work at which it
didnt so I removed it.
3. The servlet-api jar is in the tomcat lib dir and not in app lib dir
4. Didnt find the j2ee jar in the tomcat folder.


2009/2/2 Caldarale, Charles R <Ch...@unisys.com>

> > From: Shaolin [mailto:shaolinfinest@gmail.com]
> > Subject: package javax.servlet does not exist import javax.servlet.* ;
> >
> > The servlet jars cannot be found. I checked the tomcat lib
> > dir and it was present and it looks like its something to
> > do with the classpath.
>
> 1) Tell us which version of Tomcat, what JVM/JRE you're using, and what
> specific OS, including 32- or 64-bit.
>
> 2) NEVER, never, never set the CLASSPATH environment variable for Tomcat.
>
> 3) Make sure you do not have a copy of servlet-api.jar anywhere in Tomcat's
> classloader hierarchy, other than Tomcat's lib directory.  (Many
> inexperienced users erroneously put that jar in a webapps's WEB-INF/lib
> directory.)
>
> 4) Make sure j2ee.jar is not anywhere Tomcat or the JVM might stumble into
> it.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: package javax.servlet does not exist import javax.servlet.* ;

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Shaolin [mailto:shaolinfinest@gmail.com]
> Subject: package javax.servlet does not exist import javax.servlet.* ;
>
> The servlet jars cannot be found. I checked the tomcat lib
> dir and it was present and it looks like its something to
> do with the classpath.

1) Tell us which version of Tomcat, what JVM/JRE you're using, and what specific OS, including 32- or 64-bit.

2) NEVER, never, never set the CLASSPATH environment variable for Tomcat.

3) Make sure you do not have a copy of servlet-api.jar anywhere in Tomcat's classloader hierarchy, other than Tomcat's lib directory.  (Many inexperienced users erroneously put that jar in a webapps's WEB-INF/lib directory.)

4) Make sure j2ee.jar is not anywhere Tomcat or the JVM might stumble into it.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org