Two Laptop Bag
The moose likes Servlets and the fly likes package javax.servlet does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "package javax.servlet does not exist" Watch "package javax.servlet does not exist" New topic

package javax.servlet does not exist

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi guys,
I'm using eclipse and after writing a simple servlet, that works just fine, I decided to use ANT. Anyway, when running ANT I get this message:

I googelized the topic and learned that the classpath is the issue because it doesnt have the servlet.jar/ servlet-api.jar --- I placed them both on the classpath (under enviroment variable)....nothing! same error message by ANT! anyone?
[ August 06, 2006: Message edited by: Bear Bibeault ]
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
May be your system claspath environment is not set correctly.

In Environment variables > System variables > NEW

New System Variable

Variable Name: CLASSPATH
Variable Value: ABSOLUTE PATH OF servlet-api.jar (don't put semicolon in the end)

For example, suppose your servet-api.jar is in c:\Tomcat 5.5\common\lib then your variable value will be c:\Tomcat 5.5\common\lib\servlet-api.jar

Hope this will help

[ August 06, 2006: Message edited by: Naseem Khan ]

Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

The Ant javac task makes it easy to add items to your classpath wihtou having to copy them around your file system. That's a really bad idea as you can quickly lose control when upgrading to higher versions of the container.

In any case, as this is an Ant issue, moved to the Ant forum.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: package javax.servlet does not exist
It's not a secret anymore!