• 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

classes other than sevlets that are not jar-ed

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All
I need some supporting classes for my servlets and I placed them under the ~/WEB-INF/classes . Ther are in a package and I placed these supporting classes following the directory structure under the classes directory. When I am trying to import that package , I am getting the error package not found.
Shall I include the classes directory in classpath? How can I call the methods of these classes
Thanks
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I take it you mean you get the error when you are compiling the servlets. In this case, yes, you need the /WEB-INF/classes directory in your classpath:
javac -classpath .;$webapproot/WEB-INF/classes MyServlet.java
------------------
Phil Hanna
Author of :
JSP: The Complete Reference
Instant Java Servlets
 
Giri Prasad
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks once again Phil. It is working fine
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Giri,
Just in case if you keep both your .java and .class files in ..WEB-INF/classes dir, try to keep them in separate dirs. It is always good idea to separate source from others. One reason if you want to just jar your web-appln and give to someone to deploy in another server, it's so easy. If you don't want to give your source files, then you may have to move your source files to another dir before jarring them.
Easy manintenance. YOu may even want to delete everything in classes dirs and check some servlets in case if there are some problems. If you mixed both source and .class files in same dir, them it will be hard.
If you separate them we get the advantage of having different versions of source dirs.
regds
maha anna
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic