compiling servlets using Tomcat 4.1

hi experts,

I am new to servlets. I am running them using Apache Tomcat 4.1
I have written my first HelloWorld servlet program but unable to compile it. I saved it in the following directory

C:\Program Files\Apache Group\Tomcat 4.1\webapps\ap1\WEB-INF\classes\
when i try to complie using    javac    from  the classes directory in the dos prompt, it is giving 6 errors though the program is perfect.

the class path is set as  :

 set classpath=%classpath%;c:\Program Files\Apache Group\Tomcat 4.1\common\lib;c:\lotus\notes\data

and path set as

set PATH=%PATH%;C:\J2sdk1.4.2_06\bin;%JAVA_HOME%\bin;%CATALINA_HOME%\bin

will greatly appreciate your help.


LVL 10
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi jaggernat,

You have mentioned that the following is your classpath setting:

set classpath=%classpath%;c:\Program Files\Apache Group\Tomcat 4.1\common\lib;c:\lotus\notes\data

You are getting the compiler errors beause the compiler is not able to find the "standard" servlet classes like HttpServlet. There is a .jar file called "servlet.jar" or "servlet-api.jar" in the Tomcat 4.1\common\lib folder. You need to include this .jar file in your classpath for the compiler to be able to find the "standard" classes I mentioned above. Therefore, try changing your classpath to the following:

set classpath=%classpath%;c:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar;c:\lotus\notes\data

and compile again.

I think this will help.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jaggernatAuthor Commented:
yes it works.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.