Easy: why can't I even compile servlet HelloWorld?

FacuAdmin
FacuAdmin used Ask the Experts™
on
Hi. I have J2SDK 1.4.0 and Tomcat 4.1 installed. Now, I can compile with "javac" regular programs written in Java, but I cannot compile a thing with servlets!

Tomcat runs normally on http://localhost:8080 and I can run the servlet demo HelloWorld from there. But when I want to compile it on my own I get "javax.servlet doesn't exist" and obviously losts of errors from there on.

I've winXP and my enviroment variables are set:

JAVA_HOME = D:\j2sdk1.4.0_01
CLASSPATH = .
PATH = D:\j2sdk1.4.0_01\bin; SystemRoot%\system32; %SystemRoot%
BASEDIR = D:\j2sdk1.4.0_01\Tomcat 4.1
CATALINA_HOME = D:\j2sdk1.4.0_01\Tomcat 4.1

Thanks a lot
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Hi,

  You need to add "servlet.jar" to your CLASSPATH, as following:

  set CLASSPATH=%CLASSPATH%;.;D:\j2sdk1.4.0_01\Tomcat 4.1\common\lib\servlet.jar

  Good lucks!

Mick BarryJava Developer
Top Expert 2010

Commented:
or install j2ee.

Commented:
or put servlet.jar inside <jre dir>/lib/ext/ directory
set classpath=c:/Tomcat 4.1/lib/servlet.jar;%classpath%;

set class path like this at ur command promt.I am assuming u installed ur tomcat on c drive.

Author

Commented:
exactly what I needed.

now, excuse me but I'm new with servlets. I CAN compile now and I get the .class file. I also have a .htm file with <FORM method= get action="HelloWorld" > but that does not work... What do I've to set up? You can save me from reading 30 pages from the Sun page. :)

thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial