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

error compiling a servlet

mazoun yusuf

Joined: Feb 11, 2005
Posts: 19
Hello everyone,

I am getting an error message while compiling a servlet which is package java.servlet does not exist import javax.servlet*;
am using tomcat5.0 and j2sdk1.4-0..
i have set my path in the user variable as follow:
path c:\jdk\bin(i hav renamed the j2sdk)

and in the system variable i have defined:]
CATALINA_HOME C:\java\tomcat-5.0
CLASSPATH C:\CATALINA_HOME\common\lib\servlet-api.jar

please help
xtremely urgent
Vijay Sharma
Ranch Hand

Joined: Feb 02, 2005
Posts: 32
I think u have wriiten there javax.servlet*;
It should be javax.servlet.*;
That's why u are getting error for servlet package does not exist.Try this out,and then tell me.Is it ok...

Vijay Sharma
gaurav chhabra
Ranch Hand

Joined: Jul 24, 2004
Posts: 109
the above solution is correct but if it is not working then let me know
mazoun yusuf

Joined: Feb 11, 2005
Posts: 19
thanks for replying gentleman

i have written the servlet right.i wanted to know if the path and classpath are correct?
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

It's finding javac so your path is right.

It's not finding the servlet classes so either you haven't written the import statement correctly, as John suggested, or your classpath is not right.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
mazoun yusuf

Joined: Feb 11, 2005
Posts: 19
1. i have corrected the errors.however am still not being able to compile.what classpath should i use?

2. in what folder should i put the class files in my tomcat directory?

3. what changes do i have to make in the web.xml file?

(it should be noted that one class files calls for another one which inturn calls for another one)

thanks in aDVANCE
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it


Thanks! and welcome to the JavaRanch!


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: error compiling a servlet
It's not a secret anymore!