Leon,

1. Please check that you indeed have servlet.jar at this location.

2. Next, copy the servlet.jar file to some folder, start the command prompt, and go to 
that folder.
        In this folder, create a .java file with the following contents:
        public class MyClass{
                public static void main(String args[]){
                        try{
                                Class.forName("javax.servlet.GenericServlet");
                                System.out.println("Successfully loaded the Generic 
Servlet class");
                        }catch(Exception ex){
                                System.err.println("The class was not found");
                                ex.printStackTrace(System.err);
                        }
                }
        }
        Compile this class.
        Issue the following command SET CLASSPATH=./servlet.jar
        Remember, you have to have the servlet.jar file in this folder.
        Now run this newly created .class file with the command:
                java MyClass
        If you have done exactly as I've said above, and you get a ClassNotFound 
Exception, then the servlet.jar file is corrupt.
        If you get the "successfully loaded..." message instead, then you've not been 
setting your classpath correctly.

Try using Winzip to extract the contents of Tomcat 4, in case you've downloaded a .tgz 
Other archive managers that I've used - PkZip, Winrar
- did not extract the contents correctly. This has something to do with the GNU Tar 
extensions that are used create the Tomcat .tgz files
This information is posted on the Tomcat 4 download page.

Sriram


2/25/02 7:43:47 PM, Leon Vermaak <[EMAIL PROTECTED]> wrote:

>I opened autoexec.bat
>and typed the following:
>set CLASSPATH="C:\Program Files\Apache Tomcat 4.0\common\lib\servlet.jar"
>
>saved and exited. then executed autoexec.bat
>then tried to compile HelloWorld.java
>and same error persists.
>
>Any other suggestions?
>----- Original Message -----
>From: "Vivek Bhardwaj" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Monday, February 25, 2002 6:08 AM
>
>
>> of course u'll add this to your present classpath as:
>>
>> set
>> CLASSPATH=%CLASSPATH%;c:\TOMCAT_HOME\lib\servlet.jar
>>
>> vivek
>>
>> --- Vivek Bhardwaj <[EMAIL PROTECTED]> wrote:
>> > the problem u r facing is that of classpath setting
>> > ...the code in your sevlet program is not able to
>> > find
>> > the servlet package...
>> >
>> > what u can do is to go to DOS command prompt and set
>> > the classpath as :
>> >
>> > set classpath=c:\TOMCAT_HOME\lib\servlet.jar
>> >
>> > where TOMCAT_HOME is the directory where you have
>> > installed tomcat.
>> >
>> > hope this helps...in case it doesn't do write back
>> >
>> > good luck :)
>> > vivek....
>> >
>> >
>> >
>> > --- Leon Vermaak <[EMAIL PROTECTED]> wrote:
>> > > My path is fine, but in the instalation
>> > instructions
>> > > for windows me it said not to specify any path
>> > that
>> > > automatically it would look for the class? I find
>> > > this hard to believe.
>> > > I have performed a search for a javax* package on
>> > my
>> > > machine, but none exists. Strange since the
>> > samples
>> > > that come with tomcat are precompiled with import
>> > > javax?
>> > > If you could specify how I specify the classpath I
>> > > would appreciate it.
>> > > Thanks
>> > >   ----- Original Message -----
>> > >   From: kaustubh
>> > >   To: [EMAIL PROTECTED]
>> > >   Sent: Monday, February 25, 2002 12:12 AM
>> > >
>> > >
>> > >   check your classpath & path variables for
>> > j2sdkee
>> > > & jdk
>> > >   I guess thats the problem
>> > >   Kaustubh Vaze
>> > >   Internet Programmer
>> > >   [EMAIL PROTECTED]
>> > >     ----- Original Message -----
>> > >     From: Leon Vermaak
>> > >     To: [EMAIL PROTECTED]
>> > >     Sent: Monday, February 25, 2002 10:24 AM
>> > >
>> > >
>> > >     I am new to Servlets.
>> > >     I am trying to compile my fisrt Servlet. I am
>> > > working on Win Me. I have:
>> > >     jdk1.3.1_02
>> > >     j2sdkee1.3.1
>> > >     Apache Tomcat 4.0
>> > >     installed.
>> > >     Tomcat is working fine, but when I try to
>> > > compile a simple servlet it does not compile. I
>> > get
>> > > the following error message:
>> > >     HelloWorld.java:2: package javax.servlet does
>> > > not exist
>> > >     import javax.servlet.*;
>> > >     ^
>> > >     HelloWold.java:3: package javax.servlet.http
>> > > does not exist
>> > >     import javax.servlet.*;
>> > >     ^
>> > >     So how do I tell the compiler how to find
>> > these
>> > > packages?
>> > >
>> > >     Any help will be appreciated.
>> > >
>> > >
>> >
>> >
>> > =====
>> >
>> >
>> > __________________________________________________
>> > Do You Yahoo!?
>> > Yahoo! Sports - Coverage of the 2002 Olympic Games
>> > http://sports.yahoo.com
>> >
>> >
>>
>___________________________________________________________________________
>> > To unsubscribe, send email to [EMAIL PROTECTED]
>> > and include in the body
>> > of the message "signoff SERVLET-INTEREST".
>> >
>> > Archives:
>> >
>> http://archives.java.sun.com/archives/servlet-interest.html
>> > Resources:
>> >
>> http://java.sun.com/products/servlet/external-resources.html
>> > LISTSERV Help:
>> > http://www.lsoft.com/manuals/user/user.html
>> >
>>
>>
>> =====
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Yahoo! Sports - Coverage of the 2002 Olympic Games
>> http://sports.yahoo.com
>>
>>
>___________________________________________________________________________
>> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
>> of the message "signoff SERVLET-INTEREST".
>>
>> Archives: http://archives.java.sun.com/archives/servlet-interest.html
>> Resources: http://java.sun.com/products/servlet/external-resources.html
>> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>>
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to