Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package javax.servlet does not exist

 
Ravi kanth P M
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have tried an example from HFSJ, i have installed j2sdk1.4.2 in my machine and have added the same in the classpath.

When i try to compile the servlet program placing it under the j2sdk1.4.2 folder, i am getting the following error
"package javax.servlet does not exist"

did i miss anything or whether the SDK is not installed properly...?
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Does your classpath refer to the servlet API libraries?

These are located in the servlet.jar

Gian
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did i miss anything or whether the SDK is not installed properly...?


As Gian Franco said, you need a jar file for servlets, which is usually provided with your web container. If you are using Tomcat, it's in common/lib/servlet-api.jar . You'll need to put jsp-api.jar too.
 
Ravi kanth P M
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks i have tried including the servlet.jar,servler-api.jar and jsp-api.jar in the classpath. The servlet is getting compiled now.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually you need either servlet.jar or servler-api.jar, not both
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic