-
May 3rd, 2010, 05:08 AM
#1
java servlet not compiling
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!!
-
May 3rd, 2010, 05:46 AM
#2
Re: java servlet not compiling
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
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
May 3rd, 2010, 05:55 AM
#3
Re: java servlet not compiling
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)
^
Last edited by aks01; May 3rd, 2010 at 06:26 AM.
-
May 3rd, 2010, 08:31 AM
#4
Re: java servlet not compiling
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?
-
May 3rd, 2010, 09:36 AM
#5
Re: java servlet not compiling
This error:
Code:
C:\jwork>javac Howdyservlet.java
Howdyservlet.java:3: package java.servlet.http does not exist
import java.servlet.http.*;
^
Tells you what is wrong. HttpServlet is in package javax, not java. Change the import statement to
Code:
import javax.servlet.http.*;
If you are still getting a package not found error, try this:
Code:
c:\>javac HowdyServlet.java -cp ".;C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet.jar".
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.
Let us know if you need more help.
-
May 3rd, 2010, 11:04 AM
#6
Re: java servlet not compiling
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|