• 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

HelloWorld Servlet compilation errors

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,
I am new to work with Servlets. I wrote a small Servlet program to print "HelloWorld" but its giving compilation errors like:

package javax.servlet does not exist
package javax.servlet.http does not exist ...

I am using jdk1.3.1_08. can anyone tell me the reason[s].
Thanks in advance

- Pradeep

here is the code:

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have J2EE on your machine?
 
pradeep bommakanti
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Abhinay,
After I set the classpath [tomcat\lib\common\servlet.jar] the Servlet file compiled successfylly.
Thanks
-Pradeep
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just put your servlet.jar into your jdk's jre\lib\ext directory.
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kiran Sonaje:
Just put your servlet.jar into your jdk's jre\lib\ext directory.



Bad idea! What if they want to run another container which uses a different version of the servlet API using the same JRE?
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the jar file file will be under the $TOMCAT_HOME/common/lib directory.

But the jar file name will be either servlet.jar or servlet-api.jar depending on tomcat version.

For downloading the latest servlet version or specification :

http://java.sun.com/products/servlet/download.html
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic