Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error when compiling servlet.

 
Rob Levo
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Software Engg
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey check out the import statements,
and providing more info may help us to sort out ur problem
 
Rob Levo
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>");
}
}
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sandeep Jain
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rob Levo
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic