The moose likes Servlets and the fly likes error: package javax.servlet does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "error: package javax.servlet does not exist" Watch "error: package javax.servlet does not exist" New topic

error: package javax.servlet does not exist

david allen
Ranch Hand

Joined: Sep 27, 2002
Posts: 185
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 javax.servlet.*;
import javax.servlet.http.*;

class HelloClientServlet extends HttpServlet
protected void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
PrintWriter out = res.getWriter();
out.println("<HTML><HEAD><TITLE>Hello Client!</TITLE>"+
"</HEAD><BODY>Hello Client!</BODY></HTML>");
public String getServletInfo()
return "HelloClientServlet 1.0 by Stefan Zeiger";
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63349

Be sure that servlet.jar is in your classpath.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: error: package javax.servlet does not exist
It's not a secret anymore!