• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Servlet Compile Problem

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!!
 
What are you saying? I thought you said that Santa gave you that. And this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic