Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Servlets and the fly likes Configuring JDK for Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Configuring JDK for Servlets" Watch "Configuring JDK for Servlets" New topic

Configuring JDK for Servlets

ernest fakudze
Ranch Hand

Joined: Aug 27, 2001
Posts: 216
I understand that the servlet API needs to be added to JDK so that I can compile servlets. I got a file called servlets.jar which i believe is the file i need. Where do I place it or how do I set the classpath? Currently I get 100 errors when I try to compile a servlet.
Please help fellow ranchers!

In a time of drastic change it is the learners who inherit the future. The learned usually find themselves equipped to live in a world that no longer exists.<br />Eric Hoffer
Kaju Singh

Joined: Jul 30, 2001
Posts: 10
Well Ernest,
I believe, you just have to add the path of teh servlet.jar files in your "CLASSPATH".
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
This is where I have it. \jdk1.2.2\jre\lib\ext\servlet.jar


So much trouble in the world -- Bob Marley
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Placing a jar in a directory in your CLASSPATH doesn't add it to your CLASSPATH. CLASSPATH is and envirorment variable which points to jar files and class directories. You need to add the full pathname (including the ".jar" suffix) of your servlet jar to the classpath:
SET CLASSPATH=%CLASSPATH%;C:\jdk1.2.2\jre\lib\ext\servlet.jar

An IDE is no substitute for an Intelligent Developer.
ernest fakudze
Ranch Hand

Joined: Aug 27, 2001
Posts: 216
Thanks for your help ranchers. Now the new problem: I don't know which file to edit in order to set my classpath. Could anybody please tell me how to set it in Windows 98 and Windows 2K. Thanks a lot in advance!!
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
Jar files in the standard extensions directory are automatically located by the JVM before the classpath is searched. See the file named findingclasses.html in the tooldocs directory of your SDK installation. Therefore putting servlet.jar in that directory is sufficient.
The Tooldocs directory is where you will find advice on how to set up your classpath on various operating systems. Start at the tools.html file.
I agree. Here's the link:
subject: Configuring JDK for Servlets
It's not a secret anymore!