Hi,
If your "main beans directory" is
c:\somedir\your_co\beans
and you have beans without packages living in this directory then
your CLASSPATH variable for the servlet/JSP engin must have c:\somedir\beans in
it.
but if I were you I'd add the line:
package your_co.beans;
to the top of all your beans and just have c:\somedir in your CLASSPATH
The reason, ....
a) it's tidyier
b) if you ever need to deploy your beans you can just JAR them up and use the new
.jar file in your CLASSPATH's
c) It's a matter of scope, A Non-public class in a package is not accessible to
classes in another package but is accessible to classes in the same package, etc.
Karl
"Praveen Kumar S ." wrote:
> Hi,
>
> I beg pardon i do know it,
> but if it is not understood that the answer you have given is not taken care
> of,
>
> but i was not refrering to a package structure,
>
> (for hypothetication)
> i dont have a package structure, i want to keep it in the main beans
> directory
>
> it does not work, i have to use a package format, only. can you pls help me
> out as why. i have to use a package structure only
>
> regards amit
>
> > -----Original Message-----
> > From: Drew Cox [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, November 25, 1999 8:52 AM
> > To: 'Praveen Kumar S .'; [EMAIL PROTECTED]
> > Subject: RE: Running a JSP
> >
> > Sorry to disagree with your here Amit, but I don't like seeing
> > mis-information spread on Java and JSP by it's own users. That's M$'s
> > job....
> >
> > This is NOT an "inherent problem with jswdk", this is the design of the
> > Java package system. I suggest you and the original poster need to
> > brush up on your package and CLASSPATH knowledge. Trust me, once you
> > understand their relationships, it's all completely logical. Here's my
> > version, I'll be embarrased if it's wrong...
> >
> > The class path (either set as the CLASSPATH environment variable, or
> > using a command-line parameter to the java/jre command) lists the set of
> > directories and jar files files that the Java runtime will look in for
> > any classes referenced in you code. In later (from JDK 1.2 onwards, I
> > think) versions the standard/core API classes are automatically included
> > in the class path and do not need to be referenced explicitly.
> >
> > If you classes are in packages, then they need to exist under a
> > directory structure matching the package hierachy, either as physical OS
> > directories or directories within a Jar file. The parent of this
> > directory structure, or the jar filename itself, are what must be
> > referenced in the class path.
> >
> > eg.
> >
> > If my class path is set as :
> > set CLASSPATH = c:\beans
> > And my code access a class :
> > com.barrack.MyBean aBean = new com.barrack.MyBean( );
> > Then my bean class will need to live in the file :
> > C:\beans\com\barrack\MyBean.class
> >
> > All this is standard Java stuff, so it applies to JSP/Servlets and the
> > jswdk too.
> >
> > Regards
> >
> > Drew Cox
> > Barrack Consulting
> >
> >
> >
> > > -----Original Message-----
> > > From: Praveen Kumar S . [SMTP:[EMAIL PROTECTED]]
> > > Sent: Wednesday, November 24, 1999 6:42 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: Running a JSP
> > >
> > > Hi meera
> > >
> > > There is a inherent problem with jswdk
> > >
> > > you have to do this,
> > >
> > > create a subdirectory
> > > say mypackage
> > >
> > > put your jsp in it with its package as mypackage;
> > >
> > > then access it as "mypackage.mybean" in your jsp
> > >
> > > regards
> > >
> > > Amit
> > >
> > > > -----Original Message-----
> > > > From: Reeta Mittal [SMTP:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, November 24, 1999 1:25 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Running a JSP
> > > >
> > > > Hello Everyone,
> > > >
> > > > I am using JSWDK1.0.1 for JSP.
> > > > I am writting a test JSP in which I am using a test bean. Can anyone
> > > > please
> > > > tell me where I hav to place the Bean ?
> > > > I have placed the JSP in the example directory and BEAN in the
> > > WEB-INF
> > > > directory.
> > > > I have created a subdirectory under example directory and a
> > > subdirectory
> > > > under WEB-Inf directory.
> > > > I have used the JAVAC for compiling the bean.
> > > > I am getting
> > > > 500: Internal server error.
> > > >
> > > > Can anyone please help me for this....
> > > >
> > > > Regards,
> > > > Reeta
> > > >
> > > >
> > > > Regards,
> > > > Reeta
> > > >
> > > >
> > > ======================================================================
> > > ====
> > > > =
> > > > 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
===========================================================================
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