File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Help me solve Watch "Help me solve New topic
Author

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

srinivas pola
Greenhorn

Joined: Jul 18, 2008
Posts: 24
Hi,

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 BeerSelectAction.java
BeerSelectAction.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
BeerSelectAction.java:4: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
BeerSelectAction.java:7: cannot find symbol
symbol: class HttpServlet
public class BeerSelectAction extends HttpServlet {
^
BeerSelectAction.java:9: cannot find symbol
symbol : class HttpServletRequest
location: class com.example.web.BeerSelectAction
public void doPost(HttpServletRequest request,
^
BeerSelectAction.java:10: 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

Hi,

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

http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html

hope that helps you,

Regards,
Ranil


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

Joined: Nov 24, 2005
Posts: 14687
    
  16

CLASS_PATH -> CLASSPATH


[My Blog]
All roads lead to JavaRanch
srinivas pola
Greenhorn

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: http://aspose.com/file-tools
 
subject: Help me solve 'package javax.servlet does not exist' error
 
Similar Threads
help me solve 'package javax.servlet does not exist' error
Compiling servlets
compile errors
Unable to import
problem in compiling servlet