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

classes other than sevlets that are not jar-ed

 
Giri Prasad
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • 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
 
Phil Hanna
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks once again Phil. It is working fine
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic