| Author |
Can not compile, please help me
|
Sandeep Mukherji
Ranch Hand
Joined: Mar 23, 2008
Posts: 46
|
|
Hi, When I am trying to compile my code, following compile time error comes. I had set the classpath too. Please help me. *************************************************************************** D:\Servlet\Servlet1>set classpath=D:\Tomcat*\common\lib\servlet-api.jar D:\Servlet\Servlet1>javac -d ./WEB-INF/classes LoginForm.java LoginForm.java:1: package javax.servlet does not exist import javax.servlet.*; ^ LoginForm.java:2: package javax.servlet.http does not exist import javax.servlet.http.*; ^ LoginForm.java:7: cannot find symbol symbol: class HttpServlet public class LoginForm extends HttpServlet{ ^ LoginForm.java:8: cannot find symbol symbol : class HttpServletRequset location: class LoginForm public void service(HttpServletRequset req, HttpServletResponse res) ^ LoginForm.java:8: cannot find symbol symbol : class HttpServletResponse location: class LoginForm public void service(HttpServletRequset req, HttpServletResponse res) ^ LoginForm.java:9: cannot find symbol symbol : class ServletException location: class LoginForm throws ServletException, IOException{ ^ 6 errors
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by Sandeep Mukherji: ... I had set the classpath too.
It looks like it's not set correctly. See: http://faq.javaranch.com/java/CompilingServlets
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Sandeep Mukherji
Ranch Hand
Joined: Mar 23, 2008
Posts: 46
|
|
Hi , Thanks for the link. It's really very informative. But, please tell me which jar file(s) or class(es) is to be set in order to use the packages javax.servlet.* and javax.servlet.http.*
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
The jar file is servlet-api.jar. If you're using Tomcat 6.0 or higher it can be found in: tomcat/lib For 5x versions, it's in: tomcat/common/lib
|
 |
 |
|
|
subject: Can not compile, please help me
|
|
|