|
|
|
|
|
|
Re: Alternatives for deprecated IPluginDescriptor::getPluginClassLoader [message #54949 is a reply to message #54895] |
Wed, 14 December 2005 06:36 |
Eclipse User |
|
|
|
Originally posted by: kai.klesatschke.googlemail.com
Venkataramana M schrieb:
> Kai, I haven't yet implemented as Jeff McAffer had suggested, but my situation was where an external Java Class which needs to be reloaded everytime it is created afresh, also needs to refer to the classes coming under the realm of the plugin which reloads the new java class (I think the statement is too long:-))
> So I needed a way so that the new Java Class loaded into VM does not have problems referring to the plugin's class. In a way if plugin's classloader can be passed as parent classloader to an instance of URLClassloader, that solves my problem. So if my plugin class is MyPlugin, then MyPlugin.class.getClassloader() when passed to URLClassloader solved my problem temporarily.
>
>
> URLClassLoader newLoader = new URLClassLoader(getJavaClassPathURLList(),
> MyPlugin.class..getPluginClassLoader());
>
>
> Hope that helps.
>
> Thanks
> ~Venkat
thanks I did it the same way. Don't know if
SomeBundle.class.getClassLoader() is the write way?! I hope this will me
get the bundles classloader always.
|
|
|
Re: Alternatives for deprecated IPluginDescriptor::getPluginClassLoader [message #57613 is a reply to message #54949] |
Tue, 24 January 2006 04:04 |
Eclipse User |
|
|
|
Originally posted by: jeff_nospam_mcaffer.ca.ibm.com
Note that there is a Bundle.loadClass() method. I strongly suggest using
this rather than depending on some way of introspecting and finding class
and then getting its classloader. If you really need an instance of
ClassLoader then you can create a class that just forwards to the relevant
methods on Bundle for loading classes and resources.
Jeff
"Kai Klesatschke" <kai.klesatschke@googlemail.com> wrote in message
news:dnoehp$th8$1@news.eclipse.org...
> Venkataramana M schrieb:
> > Kai, I haven't yet implemented as Jeff McAffer had suggested, but my
situation was where an external Java Class which needs to be reloaded
everytime it is created afresh, also needs to refer to the classes coming
under the realm of the plugin which reloads the new java class (I think the
statement is too long:-))
> > So I needed a way so that the new Java Class loaded into VM does not
have problems referring to the plugin's class. In a way if plugin's
classloader can be passed as parent classloader to an instance of
URLClassloader, that solves my problem. So if my plugin class is MyPlugin,
then MyPlugin.class.getClassloader() when passed to URLClassloader solved my
problem temporarily.
> >
> >
> > URLClassLoader newLoader = new URLClassLoader(getJavaClassPathURLList(),
> > MyPlugin.class..getPluginClassLoader());
> >
> >
> > Hope that helps.
> >
> > Thanks
> > ~Venkat
> thanks I did it the same way. Don't know if
> SomeBundle.class.getClassLoader() is the write way?! I hope this will me
> get the bundles classloader always.
|
|
|
Powered by
FUDForum. Page generated in 0.03281 seconds