help me solve 'package javax.servlet does not exist' error
srinivas pola
Greenhorn
Joined: Jul 18, 2008
Posts: 24
posted
0
Hi,
I am using tomcat6 and jdk1.5 I am not using any IDE and trying to compile the servlets 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
When i try to run the servlet i'm getting noclassdefinitionfound exception..
Here is my xml file: <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
And please use code tags while posting code, unformatted code is not only difficult to read, but also results in less response for your post. Read this for more information.