This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

First servlet... plz help

 
Luca Bracci
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
thanks
 
Mahesh Rana
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you make sure that
JAVA_HOME
and
TOMCAT_HOME
are pointing to the right directories ?
-------------------------------------
Michael Corlion, SCJP2
-------------------------------------
 
Luca Bracci
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another option is, that you add servlet.jar to the following directory of your JDK.
<JDK_Root>\jre\lib\ext

Hope it works for you.
Bye,
Tualha Khan
Long Lost SCJP2
 
matt hooker
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Luca Bracci
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAVA_HOME should be c:\jdk1.3
and
CLASSPATH=c:/tomcat/lib/servlet.jar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic