[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [equinox-dev] (no subject)
- From: 段琦 <duanqi25@xxxxxxxxx>
- Date: Wed, 30 Mar 2011 20:18:17 +0800
- Delivered-to: firstname.lastname@example.org
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=vmR5VuHvddIwSp+QyrWSYZBAr32KeMAJc0iadxwAQrIicJhV1ArQd8grCpC2Vqj+Zp PPhkwcoM2R/055rhm5FxPClznjHVp1pXT90cGKEBVASq5aUjmtvvaPC8JOXmQgQlg912 rgjz6QR55nfXGI8U0+fWx204FuuFEUznTmP8c=
Thanks for your reply,actually the Activator.class.getClassLoader() is just fine.
2011/3/30 Neil Bartlett <njbartlett@xxxxxxxxx>
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,