Tim Lucia wrote:
>
>> -----Original Message-----
>> From: Christopher Schultz [mailto:[EMAIL PROTECTED]
>> Sent: Saturday, April 14, 2007 2:51 PM
>> To: Tomcat Users List
>> Subject: Re: getResourceAsStream returning blank (NOT NULL)
>>
> Tim,
>
> Tim Lucia wrote:
> >>>> From: Johnny Kewl [mailto:[EMAIL PROTECTED]
> >>>> InputStream in =
> getClass().getResourceAsStream(sPackageNameWithSlashes);
> >>>> If the class name is com.myCo.data
> >>>>
> >>>> You put it in like this /com/myCo/data
> >>>>
> >>>> Also because this stuff looks for a class loader.... I dont think it
> will
> >>>> work in a STATIC class.
> >>>> Use a normal class....
> >>> Static classes are loaded by a classloader.  You can't say getClass(),
> >>> however.  Instead you would say MyClass.class.xxx()...
> Why not? The method isn't static, so there does exist a "this" on which
> getClass() could be called.
>
> > If you have an instance, then of course you have a this and of
> course you
> > can call getClass().  If you haven't got an instance, you can't call
> > getClass().  I.e.,
>
> > public Foo {
> > }
>
> > Foo.getClass() -- illegal.
> > Foo.class.getResourceAsStream() -- legal
>
> > Presumably the poster above meant "singleton" (private default
> constructor)
> > rather than Static, as classes aren't static.  In this case, you cannot
> > instantiate an instance and so you can't have a this pointer.
>
> > Tim
>
> -chris
That is correct, Singleton
>>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to