compiling servlets using Tomcat 4.1

Posted on 2004-10-26
Medium Priority
Last Modified: 2013-11-24
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 HelloWorld.java    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.


Question by:jaggernat

Accepted Solution

runa_paathak earned 600 total points
ID: 12418817
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.

LVL 10

Author Comment

ID: 12424927
yes it works.


Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Simple Linear Regression
Six Sigma Control Plans

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question