• 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

new to servlets! plz help!!!

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

i am new to servlets and jsp. i have succesfully downloaded tomcat 3.2.1 . i wrote a program HelloServlet.java and when i tried to compile it i am getting -
import javax.servlet.* not found
etc etc for all javax imports
i am running it on win98 and have jdk1.2.2
should i change my classpath so that it also points to javax package or anything like that?
Please help. i am struggling with this from yesterday.
thank you,
rajani
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, u have to set the classpath to point to the javax.servlet.* package.
 
rajani peddi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Nitin Shivaram,
the problem with the import is gone now. but i am still getting an error as:
superclass HttpServlet of class HelloWorld not found and
similarly superclass GenericServlet of class HelloServlet not found (2 different programs)
could you throw more light into this problem. is there anything else i am missing?
thank you once again
rajani
 
rajani peddi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anyone help me with the above problem. Why am i getting this error - Superclass HttpServlet of class HelloWorld not found
when i give - public class HelloWorld extends HttpServlet {
Thank you
rajani
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rajani,
The problem is only because of classpath has npot been set properly
How did u solved u'r import problem..
Have u set u'r classpath properly..
Saran
 
rajani peddi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi saran,

here are the contents of autoexec.bat in my system:
SET CLASSPATH=c:\jdk1.2.2\lib\tools.jar
PATH=%PATH%;c:\jdk1.2.2\bin;
SET PATH=%PATH%;c:\games\tomcat\jakarta-tomcat-3.2.1\bin

SET CLASSPATH=%CLASSPATH%;c:\games\tomcat\jakarta-tomcat-3.2.1\webapps\root\docs\api
SET JAVA_HOME=c:\jdk1.2.2
SET TOMCAT_HOME=c:\games\tomcat\jakarta-tomcat-3.2.1
I am not having any problem with import but only with what i have mentioned above. Can u look at my classpaths and tell me where i am wrong?
Waiting for a reply
thank you
rajani
 
Saran Vel
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rajani,
I haven't used Tomcat but i guess this may be a problem..
Try by including these files in your class path
set CLASSPATH=%TOMCAT_HOME%\classes
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
The problem is the compiler not able to find the HttpServlet classes in the class path..
Hope this helps
Saran
 
rajani peddi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you saran.
The problem was not with the classpath. I downloaded servlet.jar from sun's site and everything was compiled well. I am now able to compile and test all my servlets.
We need not include all the jar files, i believe that the tomcat will automatically include them.
Thanks you once again for replying.
rajani
 
reply
    Bookmark Topic Watch Topic
  • New Topic