aspose file tools*
The moose likes Ant, Maven and Other Build Tools 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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "package javax.servlet does not exist" Watch "package javax.servlet does not exist" New topic
Author

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


Naseem
[ 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
Marshal

Joined: Jan 10, 2002
Posts: 60072
    
  65

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] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
And of course a jarfile isn't automatically on the classpath just because it's in a directory that contains another jarfile that is on the classpath...
Though with ant scripts it can look like that because many are set up to include every jar in a specific directory.

Using a system wide classpath is almost as bad an idea as moving every jarfile into a specific directory.


42
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
right! i solved it with the ant settings. thankx
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: package javax.servlet does not exist
 
Similar Threads
package javax.servlet does not exist
compile errors
package javax.servlet does not exist
What problem is this?
Compile a Servlet