Forums Register Login

Error when compiling servlet.

+Pie Number of slices to send: Send
Almost there.
Have jdk1.3
Have javawebserver2.0
getting compile error on servlet
can not find java.servlet, etc
I guess classpath is wrong or something similar in environment
Help please.
Thanks
+Pie Number of slices to send: Send
hey check out the import statements,
and providing more info may help us to sort out ur problem
+Pie Number of slices to send: Send
Here is the servlet, just the basic helloworld:
Compile did not get past the import java.servlet.*
import java.io.*;
import java.servlet.*;
import javax.servlet.*;
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<head>");
out.println("<title>Hello World!</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Hello World!</h1>");
out.println("</body>");
out.println("</html>");
}
}
+Pie Number of slices to send: Send
Please check if your jdk1.3/jre/lib/ext directory is empty. If that subdirectory is empty, it means that you don't have the servlet.jar file. Then, try to find servlet.jar file from jdk1.2.2 and copy it. Hope it is the right clue.
+Pie Number of slices to send: Send
Hello there,
U are making use of HttpServlet class without importing the required package.
U have to import javax.servlet.http.*
and ur program will work fine.

------------------
Sandeep Jain
+Pie Number of slices to send: Send
Thanks!
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 822 times.
Similar Threads
error-page doubt
Paths
Websphere Test Environment
Browser won't show url. Web.xml
jstl ..c:set
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:32:11.