Two Laptop Bag*
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 Android Security Essentials Live Lessons this week in the Android 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

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
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
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="" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="" 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
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.
maha anna
Consider Paul's rocket mass heater.
subject: classes other than sevlets that are not jar-ed
Similar Threads
Tomcat unable to find servlet in Shared linux java hosting Server
Unable to load tag handler class!!!
In JSP, How to import a java class that exists in default package?
JAXB External Cutomization.
How to create package for web app in Eclipse