• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

First servlet... plz help

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JAVA_HOME should be c:\jdk1.3
and
CLASSPATH=c:/tomcat/lib/servlet.jar
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic