• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet Compile Problem

 
P Thorp
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two, I hope simple questions. Any help would be appreciated.

Question 1 of 2
I am new to the Java world as well as servlets. I am trying to compile a simple servlet controller module. (page 80 Headd First Servlets and JSP).

The compiler is telling me that the import package javax.servlet does not exist.

src\com\example\web\BeerSelect.java:9: package javax.servlet does not exist
import javax.servlet.*;
^

I am running jdk 1.5.0. Is this not backward compatible wit jdk1.4 or do I need to install jdk 1.4 for the examples in this book?

Question 2 of 2.
If I have to revert back to jdk 1.4 how do I tell eclipse to use the older version of the jdk.

Thanks pt
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You just need to import servlet-api.jar to your eclipse project. You would find this library in your TOMCAT_HOME/commons/lib.

Thanks.
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you set the classpath and javahome. Once you set the servlet-api.jar path you wouldn't probably get an error.

If it doesn't understood then do let me say i will tell you the precompilation steps.
 
P Thorp
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to thank you for your help. I got the native compile done and I also got it to compile in eclipse.

Once again thanks!!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!