• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error: package javax.servlet does not exist

 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to write my first servlet (I have jsp working) Note: I have not downloaded ant???
when I compile it tells me that it cant find javax.servlet. Any ideas. thanks
here is my code
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

class HelloClientServlet extends HttpServlet
{
protected void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<HTML><HEAD><TITLE>Hello Client!</TITLE>"+
"</HEAD><BODY>Hello Client!</BODY></HTML>");
out.close();
}
public String getServletInfo()
{
return "HelloClientServlet 1.0 by Stefan Zeiger";
}
}
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be sure that servlet.jar is in your classpath.
hth,
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic