aspose file tools*
The moose likes Servlets and the fly likes classes other than sevlets that are not jar-ed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "classes other than sevlets that are not jar-ed" Watch "classes other than sevlets that are not jar-ed" New topic
Author

classes other than sevlets that are not jar-ed

Giri Prasad
Ranch Hand

Joined: Mar 08, 2001
Posts: 56
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

Joined: Apr 05, 2001
Posts: 118
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


Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
Giri Prasad
Ranch Hand

Joined: Mar 08, 2001
Posts: 56
Thanks once again Phil. It is working fine
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
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.
 
subject: classes other than sevlets that are not jar-ed
 
Similar Threads
Tomcat unable to find servlet in Shared linux java hosting Server
JAXB External Cutomization.
How to create package for web app in Eclipse
Unable to load tag handler class!!!
In JSP, How to import a java class that exists in default package?