File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Basic question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Basic question" Watch "Basic question" New topic

Basic question

Rajeev Nair
Ranch Hand

Joined: Mar 11, 2002
Posts: 51
I just configured Tomcat 4.0.3 and was able to get the tomcat up and running. I tried to compile a simple servlet and I ran into compilation problem.
I have put my servlet in
I have set the class path and put in autoexec.bat as
set CLASSPATH=.;c:\servletdevel;c:\tomcat\common\lib\
when I tried to compile it is not recognizing the package import javax.servlet.http.*;.
Can anybody let me know is there something i missed out in classpath setting.
Thanks in advance

Raj<br />Sun Certified Java Programmer
Faraz Masood
Ranch Hand

Joined: May 03, 2002
Posts: 55
i also got the same problem when i first tried to run my servlet and here is my way of getting out of that
set classpath=c:\tomcat\common\lib\servlet.jar and dont write anything else in that line
i.e. only define single class path
for your servlets to be eligible to run .. you need to put them in tomcat/webapps/examples/web-inf/classes and your html files in tomcat/webapps/ROOT
there are ways to store that files in your own directory by playing with server.xml ... but first to keep things simple you should not try that out
hope this helps
Rajeev Nair
Ranch Hand

Joined: Mar 11, 2002
Posts: 51
Thanks Faraz. I did the same and was able to get the stuff compiled. Let me know how to play around with server.xml.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
When your servlets get more complicated and need additional libraries, look into the ANT utility to control the compilation. ANT makes it easy to set up classpaths for the compiler without changing your environment variables. Find ANT at:
Rajeev Nair
Ranch Hand

Joined: Mar 11, 2002
Posts: 51
Thanks for the info Bill
I agree. Here's the link:
subject: Basic question
It's not a secret anymore!