aspose file tools*
The moose likes Servlets and the fly likes new to servlets! plz help!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "new to servlets! plz help!!!" Watch "new to servlets! plz help!!!" New topic
Author

new to servlets! plz help!!!

rajani peddi
Ranch Hand

Joined: Nov 27, 2000
Posts: 73
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

Joined: Jan 17, 2001
Posts: 71
Yes, u have to set the classpath to point to the javax.servlet.* package.

Nitin S<br />Sun Certified Java Programmer for the Java 2 platform.<br />Tekmetrics Certified Java Programmer For the Java 2 Platform.
rajani peddi
Ranch Hand

Joined: Nov 27, 2000
Posts: 73
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

Joined: Nov 27, 2000
Posts: 73
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

Joined: Nov 03, 2000
Posts: 111
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


Saran
Sun Certified Java2 Programmer
rajani peddi
Ranch Hand

Joined: Nov 27, 2000
Posts: 73
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

Joined: Nov 03, 2000
Posts: 111
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

Joined: Nov 27, 2000
Posts: 73
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: new to servlets! plz help!!!