Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to cross over "javax.servlet.* not found " problem?

 
ramesh kumar
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends
I ve been developing a servelet program. when I compile my code it gives me a error like "javax.servlet.* not found " .
what is the cause for this?
My code is below.
import java.io.*;
import javax.servlet.*;
public class HelloServlet extends GenericServlet {
public void service (ServletRequest request, ServletResponse response)

throws ServletException, IOException {
response.SetCOntentType("text/html");
PrintWriter pe =response.getWriter();
pw.println("<B>Hello!");
pw.close();
}
}
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13077
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the compiler tells you a message like that it means that the package can't be found on the current CLASSPATH.
You can either set the CLASSPATH or put the servlet.jar file where the compiler can find it. The "javax" means that the package is a "standard extension" so you can put the JAR file in the jdk/jre/lib/ext directory with the other standard extensions.
Bill
 
ramesh kumar
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for ur reply.
where to find this javax.servlet class?
As I am new to servlets I need to more about it.
I've downloaded Java web server and jdk1.2.2 earlier.?
Is it not enough? If so where to find Javax.servlets files?
Please enlighten me pals.
thanks.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13077
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what the JWS package names the jar file containing those classes.
You really should be working with the Tomcat Server anyway, as far as I know, Sun turned over development of the "reference" version of servlets and JSP to the Apache organization last year and does not update the JWS any more. Download Tomcat 3.2 from
jakarta.apache.org
In Tomcat the servlet classes are in a servlet.jar file in the
/Tomcat/lib directory.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic