Handle to project's classloader [message #303612] |
Thu, 18 May 2006 00:19 |
Eclipse User |
|
|
|
Originally posted by: kautulm.bea.com
Does anybody know how can I can get a handle to a project's classloader? My
plugin needs access to the project's classloader and I am not able to find a
way to get a handle to it.
Thanks in advance for your reply.
-Kautul
|
|
|
|
Re: Handle to project's classloader [message #303667 is a reply to message #303641] |
Thu, 18 May 2006 18:41 |
Eclipse User |
|
|
|
Originally posted by: kautulm.bea.com
Let's say that I have a project foo of type 'Web project' in my workspace.
Now, it has dependencies defined on other projects and so on. So, at runtime
when this web project is deployed, it will have a classloader of it's own
which will define what all this web project can access. My plugin needs the
design time equivalent of this classloader to find classes/resources that
this web project can access. So, my question is how do I get a handle to a
project's classloader/classpath. There is a way of doing this for java
projects through IJavaProject.getResolvedClasspath(), but what about other
types of projects.
"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:e4hm31$b3e$1@utils.eclipse.org...
> Kautul Mehta wrote:
>> Does anybody know how can I can get a handle to a project's classloader?
>> My plugin needs access to the project's classloader and I am not able to
>> find a way to get a handle to it.
>
> What's a project classloader? When eclipse is running you have the
> application classpath (which is startup.jar) and the bundle classpaths.
>
> Within your plugin, you can see your own plugin classloader.
> MyPlugin.class.getClassLoader().
>
> You can get eclipse to load classes from any plugin using that plugin's
> Bundle#loadClass(*) method. You can find bundles using
> Platform#getBundle(*).
>
> Through OSGi, you can also get find the bundle that loaded a particular
> class.
>
> Later,
> PW
|
|
|
|
Powered by
FUDForum. Page generated in 0.03382 seconds