File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Problem compiling a simple servlet - newbie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem compiling a simple servlet - newbie" Watch "Problem compiling a simple servlet - newbie" New topic

Problem compiling a simple servlet - newbie

Charu Krishnan

Joined: Oct 24, 2000
Posts: 19
I am new to servlets and just downloaded Tomcat - version 3.2.1
Since I am working on Windows 95 thought an earlier version may be better. Also working with J2EE 1.3
I set up all the environment variables and classpaths.
Now I have my test servlet under the directory c:\servlets. I am compiling it using the following command from the directory c:\servlets "javac -classpath servlet.jar;". I get no error messages, but find no class files under this directory as expected.
If I don't specify the classpath then I get errors while compiling saying that it can't find the required libraries, so definitely when I specify the right classpath I know that it has all the libraries to compile. It is a weird problem since I don't get any error messages.
I am wondering if I need to place the file somewhere in the tomcat install_dir or is it some problem like that. Amy advice would be much appreciated.
Sita Kodali
Ranch Hand

Joined: Dec 02, 2001
Posts: 72
One of the best ways is to copy servlet.jar from <tomcat3.2xfolder>/lib into your <jdkfolder>/jre/lib/ext. Each jar file in this folder will come into classpath without explicit %classpath% variable declaration.
You can compiel all your servlets without adding -classpath suffix
Charu Krishnan

Joined: Oct 24, 2000
Posts: 19
Thanks a ton Venkat. I have been breaking my head for two days over this and finally it is resolved
Many thanks
I agree. Here's the link:
subject: Problem compiling a simple servlet - newbie
Similar Threads
problems compiling servlets
Setting classpath and compiling HELP!
william, help needed
Problem running first servlet
compiling command: servlet-api.jar:classes: . ?