Solved

compiling servlets using Tomcat 4.1

Posted on 2004-10-26
483 Views
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.

Thanks,
J





0
Question by:jaggernat
    2 Comments
     
    LVL 3

    Accepted Solution

    by:
    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.

    0
     
    LVL 10

    Author Comment

    by:jaggernat
    yes it works.


    thanks,
    J
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: Foundations of Front-End Development

    Jump-start a lucrative career in front-end web development, with zero previous coding experience required. This course covers the basic programming concepts and languages required for creating engaging websites from scratch.

    Suggested Solutions

    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    A short article about problems I had with the new location API and permissions in Marshmallow
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

    933 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now