File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Help me solve 'package javax.servlet does not exist' error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Help me solve Watch "Help me solve New topic

Help me solve 'package javax.servlet does not exist' error

srinivas pola

Joined: Jul 18, 2008
Posts: 24

I have completed SCJP and now started preparing for SCWCD.
I have installed tomcat6 and jdk1.5

I am not using any IDE and compiling the classes through command prompt itself.

The environment variables i have set are as follows:
CLASS_PATH - C:\jdk1.5\lib;C:\tomcat6\lib\servlet-api.jar;C:\tomcat6\lib\jsp-api.jar;C:\tomcat6\webapps
JAVA_HOME - C:\jdk1.5
Path - C:\jdk1.5\bin;C:\jdk1.5;C:\jdk1.5\jre\bin\server

When i'm trying to compile the servlet i'm getting this error

C:\tomcat6\webapps\HeadFirst\WEB-INF\classes\web>javac package javax.servlet does not exist
import javax.servlet.*;
^ package javax.servlet.http does not exist
import javax.servlet.http.*;
^ cannot find symbol
symbol: class HttpServlet
public class BeerSelectAction extends HttpServlet {
^ cannot find symbol
symbol : class HttpServletRequest
location: class com.example.web.BeerSelectAction
public void doPost(HttpServletRequest request,
^ cannot find symbol
symbol : class HttpServletResponse

Please help me solve this error.

Thanks in advance.
Ranil Liyana Arachchige
Ranch Hand

Joined: Sep 20, 2008
Posts: 71


It looks like your classpath has not well been set, please refer to this url and see if you can set it properly

hope that helps you,


SCJP 1.4 (80%) , SCWCD5.0 (91%) , SCEA / OCMEA
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688


[My Blog]
All roads lead to JavaRanch
srinivas pola

Joined: Jul 18, 2008
Posts: 24
Thanks for the replies...

I was thinking in a complicated manner and forgot about the simple things

Anyways thanks a lot
I agree. Here's the link:
subject: Help me solve 'package javax.servlet does not exist' error
It's not a secret anymore!