i have set classpath=".;C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet.jar".
and compiled servlet program on the command line as-
c:\>javac HowdyServlet.java
then also it's not working
any guesses!!
Printable View
i have set classpath=".;C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet.jar".
and compiled servlet program on the command line as-
c:\>javac HowdyServlet.java
then also it's not working
any guesses!!
Post up the full text of the error message you get. Java error messages generally tell you what the problem is.
Unless in communicating with it [a computer] one says exactly what one means, trouble is bound to result...
A. Turing
okay.
C:\jwork>javac Howdyservlet.java
Howdyservlet.java:3: package java.servlet.http does not exist
import java.servlet.http.*;
^
Howdyservlet.java:5: cannot find symbol
symbol: class HttpServlet
public class HowdyServlet extends HttpServlet{
^
Howdyservlet.java:6: cannot find symbol
symbol : class HttpServletRequest
location: class HowdyServlet
public void doGet(HttpServletRequest request,
^
Howdyservlet.java:7: cannot find symbol
symbol : class HttpServletResponse
location: class HowdyServlet
HttpServletResponse response)
^
Really need more information about how you are trying to run this. Are you trying to run this within the tomcat container? Did you create the folder structure under "webapps/" yourself and place the compiled class out there? Did you create the TOMCAT_HOME and CATALINA_HOME environment variables?
This error:
Tells you what is wrong. HttpServlet is in package javax, not java. Change the import statement toCode:C:\jwork>javac Howdyservlet.java
Howdyservlet.java:3: package java.servlet.http does not exist
import java.servlet.http.*;
^
If you are still getting a package not found error, try this:Code:import javax.servlet.http.*;
and see if you get the same error. If not, there is something wrong with the way you set your classpath. If so, the jars are still not being found.Code:c:\>javac HowdyServlet.java -cp ".;C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet.jar".
Let us know if you need more help.
i have posted same question on multiple forums but none of them figured it out that servlet class is in javax package.
hey senior brother thanks a lot.
this problem have consumed my whole day, i have corrected the above said statement and is working like cheeseeee on the bread.
thanks a lot for the time and the solution.
once again thanks all of you for showing kindness and ofcourse for putting your brains in my problem.
i will continue posting my problems here..
thanks.