This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

where is servlet package

 
Tom Tang
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm very new to server side. I'm using JDK1.3 on Win98 and already set up Tomcat. I have no problem running the examples. But when I tried to use compile some of the source code in the example(of course, you already have the class files sitting there). I just want to compile myself but get a bunch of errors. It seems javax.servlet package is not included in JDK1.3. So do I need to have J2ee to develop servlets? Or there is some way out.
 
Tom Tang
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find this in one tutorial at sun's site:
Before you can invoke a servlet, you must compile it. Many vendors offer IDEs equipped with servlet wizards that make it easy to create and compile servlets almost automatically. The Guestbook servlet presented in this article was created and compiled using IBM's WebSphere Studio IDE.
Does it mean we can't compile servlet with EditPlus or TextPad? I'm still a loss when it comes to compile codes with "import javax.servlet.*" The compiler always fails to recognize this package. What am I missing here?
I would appreciate if someone can help me out.
Weiye Tang
 
Sean Casey
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to either download the Servlet package and install it, or install J2EE. Somebody mentioned that it comes with TomCat, but i'm not sure.
 
Meng Tan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its in \tomcat\lib\servlet.jar
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You definately can compile a servlet (and EJB's too) with TextPad, this is what I use.

The only thing you need to do is include the appropriate jar file in the classpath (in your case, servlet.jar). I've set up a custom command to do this. In TextPad, Configure|Preferences|Tools then click the Compile Java and in the Parameters, include " -classpath mypathto/servlet.jar" in front of the $File
 
Tom Tang
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One book instructed to copy servlet.jar to jdk1.3\lib\ext And then all the servlet compiles fine. But I don't know why. The ext folder is empty before copying.
 
Eviano Afiemo
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tom Tang:
One book instructed to copy servlet.jar to jdk1.3\lib\ext And then all the servlet compiles fine. But I don't know why. The ext folder is empty before copying.

Hi guys,
I'm using JRun3.0 and in case anyone else using JRun has this problem, the servlet.jar class is in the lib/ext directory.
I copied the jar file to the jdk sub directory as suggested above, but that didn't quite work for me, however I added the path to my classpath and thankfully I'm now able to compile servlets using Textpad.
Thanks for the info above guys.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic