• 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

oobtaining servlets.class file independently

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have tomcat(5.9) installed - working fine(os- windows xp). i dont hav ant, cvs installed . so i have to go for text editor.trying my first servlet programm - i was unable to get the .class file for the servlet .

as ref from HFSJ book pg no:31 , i followed the same :

from the dos prompt i tried with - %javac -cp /CATALINA_HOME/common/lib/servlet-api.jar -d classes src/ch1.java
then with javac -cp /CATALINA_HOME/common/lib/servlet-api.jar -d classes src/ch1.java
,,,,,,then with javac -cp /CATALINA_HOME\common\lib\servlet-api.jar -d classes src/ch1.java -
but i always got the error that it cannot find the servlet class etc..(it was treated as ordinany java programm instead of servlet).

i want to know without using ant & cvs , how an beginner like me can compile servlet & jsp- get .java files & deploy them in tomcat container.after getting well versed only - i can move with those advance stuffs(ant,cvs)
TOMCAT DOC - DISCUSSES ALONG WITH ANT,CVS .Any doc which could support this beginner for carring deployment independently will be more appreciable . thank u .
 
riyaz udeen
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my intension is to compile an servlet.java programm in order to obtain its .class file.well frnds when i do the above - i get - cannot find the symbol javax.servlet.moreover when i try to open the servlet-api.jar file in common\lib directory , i get an error - unable to load the main.class manifest attribute..some thing like that.

i would be happy with ur reply..thank u.

regards
riyaz
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to write CATALINA_HOME like %CATALINA_HOME%, or otherwise it is taken literally.

Oh, and you can't open a jar file by double-clicking. You need to use the command-line tool "jar". E.g., "jar -tf servlet-api.jar" will list its contents.
[ November 11, 2005: Message edited by: Ulf Dittmer ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

... it was treated as ordinany java programm instead of servlet).



As far as the compiler's concerned, a servlet is an ordinary java class (with some dependencies).

You may want to check out this entry in the servlet FAQ, which leads into the Java In General forum classpath FAQ:
http://faq.javaranch.com/view?CompilingServlets
 
riyaz udeen
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank u all ...i got it..it was all about setting the classpath for servlet-api.jar file..

regards
riyaz
scjp1.4
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic