This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes First servlet... plz help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "First servlet... plz help" Watch "First servlet... plz help" New topic

First servlet... plz help

Luca Bracci

Joined: Oct 07, 2001
Posts: 8
I am really having problem compiling my first servlet...
My tomcat is running but when I compile the servlet it says that javax,.servlet not found plz help
Mahesh Rana
Ranch Hand

Joined: Sep 05, 2001
Posts: 139
Did you make sure that
are pointing to the right directories ?
Michael Corlion, SCJP2

Luca Bracci

Joined: Oct 07, 2001
Posts: 8
Yes I did
java_home is pointing to the jdk/bin and tomcat one is pointing to the tomcat root folder,,, the problem is not in running of tomcat its that I cant get my class path to working , I cannot include javax.servlet ...
my servlet.jar is in tomcat/lib/servlet.jar
what whould be my class path?
Rupali Desai
Ranch Hand

Joined: May 29, 2001
Posts: 42
try this with your classpath.
set CLASSPATH=.\;D:\JDK1.3.1\LIB\TOOLS.JAR\;d:\tomcat\lib\servlet.jar\;
I also have restart my computer for the classpath to permanently take effect.I running win98 and tomcat version 3.1
Tualha Khan
Ranch Hand

Joined: Nov 22, 2000
Posts: 287
Another option is, that you add servlet.jar to the following directory of your JDK.

Hope it works for you.
Tualha Khan
Long Lost SCJP2

SCJP2, BEA WLS 6.0, DB2 UDB 7.1
matt hooker
Ranch Hand

Joined: Jul 26, 2001
Posts: 46
you should not need to restart your machine, just close the console window and open a new one.
I would also say that constantly adding everything to your global classpath variable is a very bad thing, try to avoid this. You could do what I do and create a batch file that dynamically sets your classpath for your working environment.

Or like Tualha says, add the jar to the extensions directory (though many hardened developers may frown on this too ...) better to keep development specific jars contained in their own environment, so as not to cause problems later as you need to use more and more Jars for your development.
If you want an example of a bat, let me know and I'll dig one out.

Its not what you do, its the way you say you've done it.
Luca Bracci

Joined: Oct 07, 2001
Posts: 8
oh man this is sad and embarassing ....
I still can't get it to work, I tried everything you guys suggested , I am really discouraged now...
1 last try perhaps ...
Ok here :
My jdk directory ----- c:/jdk1.3/bin
my tomcat directory ----- c:/tomcat
servlet.jar ---- c:/tomcat/servlet.jar
my JAVA_HOME ----- c:/jdk1.3/bin
my TOMCAT_HOME ----- c:/tomcat
Tomcat is running fine , everythign is fine BUT I cant compile my first servlet ... the compiler gives me an error on the import statement indicating javax.servlet not found...
What do I do?
thanks for bearing with my dumbness...
Now what do I do ?? ;( ;( ;( ...
this is the batch file i created for it :
set path =c:/jdk1.3/bin
set path =c:/tomcat/lib/servlet.jar
which is not working ...
Mahesh Rana
Ranch Hand

Joined: Sep 05, 2001
Posts: 139
JAVA_HOME should be c:\jdk1.3
I agree. Here's the link:
subject: First servlet... plz help
It's not a secret anymore!