This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes where is servlet package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "where is servlet package" Watch "where is servlet package" New topic
Author

where is servlet package

Tom Tang
Ranch Hand

Joined: Dec 24, 2000
Posts: 133
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.


Sun Certified Java Programmer
Tom Tang
Ranch Hand

Joined: Dec 24, 2000
Posts: 133
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

Joined: Dec 16, 2000
Posts: 625
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

Joined: Jan 20, 2001
Posts: 115
Its in \tomcat\lib\servlet.jar
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Dec 24, 2000
Posts: 133
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

Joined: Mar 20, 2001
Posts: 21
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.
 
jQuery in Action, 2nd edition
 
subject: where is servlet package
 
Similar Threads
Help, servelet compile
Emergency !!!!!!!!!!!!!!!!
HELP! I can't compile!!! Classpath / packaging problem?
How to compile/interpret ur own package's classes
How to compile/interpret ur own package's classes