• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

package javax.servlet does not exist

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
right! i solved it with the ant settings. thankx
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic