This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

new to servlets! plz help!!!

 
rajani peddi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • 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
 
Nitin Shivaram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
Saran Vel
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic