Hi, Guys, Thanks for your mails. I can package those beans, say "package myBeans;" and then put all beans in a sub-directory called myBeans. The problem is: if this directory is under SERVLET root directory, in my case it is c:\WebSphere\AppServer\Servlets, I can load all bean classes. BUT if I put the myBeans directory in somewhere else, then I can't load classes again. So the questions are: What is the current root directory when we using servlet ? Is it the Servlet root directory (in my case: c:\ WebSphere\AppServer\Servlets) ? If yes, how can we load classes from other directories rather than its sub-directories in Servlet using Java code, again in my case, to do the bean class introspection ? I have a feeling that classpath is the weak point of JAVA, it really makes application develpement, inter-application communication and remote debugging a little bit bumpy. Regards Hong Zhang -----Original Message----- From: Kevin Riff [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 13, 1999 11:18 AM To: [EMAIL PROTECTED] Subject: Re: dynamically load a class in servlet Actually, no package==root directory. That means that a class with no package (or more accurately, a class in the default package) could be located in any of the directories or jar files listed in the classpath but not in any sub-directory of those places. It happens that the current directory is usually in the classpath so your response is partly right. Its still important for a Java bean to be placed in a package to avoid name space conflicts with other libraries. Carsten Heyl wrote: > Hi Hong, > > put it in a package. No package==current directory. > How many current directories can you have. > > >Hi, all: > > > > I'm trying to load a bean class using "Class.forName(beanClass)" for > >introspection in a servlet. It's working as long as bean classes are placed > >in the root directory of servlet. In my case, the servlet directory is > >c:\WebSphere\AppServer\Servlets ( I'm on Windows NT 4.0 and using IBM > >WebSphere v2.0). If I put class files in somewhere else, for example, > >c:\BeanLib, there will be a ClassNotFoundException. I did not package any > >beans. I set the classpath in both System and user level to include > >c:\BeanLib, still the same problem. > > > > Any help or hint will be greatly appreciated. > > > > > >Hong Zhang > > > >=========================================================================== > >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST" > . > >FAQs on JSP can be found at: > > http://java.sun.com/products/jsp/faq.html > > http://www.esperanto.org.nz/jsp/jspfaq.html > > Ciao, > Carsten Heyl > > Carsten Heyl [EMAIL PROTECTED] > NADS - Solutions on Nets http://www.nads.de/ > NADS GmbH http://www.pixelboxx.de/ > Hildebrandtstr. 4E Tel.: +49 211 933 02-90 > D-40215 Duesseldorf Fax.: +49 211 933 02-93 > > =========================================================================== > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". > FAQs on JSP can be found at: > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.html =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". FAQs on JSP can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". FAQs on JSP can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html
