Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] (no subject)

It would be better if you tell us what you're actually trying to
achieve. Messing around with classloaders is usually not necessary,
unless working with a legacy library that forces you to do it.

Nevertheless, to answer your actual question: if your code is in
"MyClass" then MyClass.class.getClassLoader() will return the
classloader that loaded it -- just as it always does in Java. So if
MyClass is part of a bundle then its classloader will be the bundle

Be careful NOT to use "this.getClass().getClassLoader()" because
somebody may subclass your class, in which case "this" will not be the
"this" you thought it was!


On Wed, Mar 30, 2011 at 12:04 PM, 段琦 <duanqi25@xxxxxxxxx> wrote:
> Hi everyone,
>         could you please tell me how can I get the ClassLoader of the
> current bundle?It seems the
> Activator.bundleContext.getClass().getClassLoader() can't work.
>      Looking forward your reply,Thanks.
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx

Back to the top