[ImageJ-devel] KNIP dynamic ImageJ plugin loading
Curtis Rueden
ctrueden at wisc.edu
Tue Jun 5 15:33:58 CDT 2012
Hi Michael,
I apologize for the delay in my reply; I was on vacation recently and am
still a bit behind on email.
> Do you currently plan to support user defined Plugin folders in ImageJ2?
>
Yes, we plan to support specification of an ij.plugins.path system
property, similar to Java classpath, that defines the folder(s) where
ImageJ plugins can be found. Actually, discovery of plugins will not be
limited to this path either, but ImageJ2 will be more thorough in scanning
those folders, versus other classpath elements.
I filed a ticket for this: http://trac.imagej.net/ticket/1208
> Furthermore I had some trouble while creating a test plugin for ImageJ2
> with Eclipse and I wrote down the learned lessons because this might be
> usefull for other users as well.
Yes, we need to make it easier to develop plugins in Eclipse. We have a
feature ticket covering these issues:
http://trac.imagej.net/ticket/1207
The main idea is to generate an Eclipse project from ImageJ, so you don't
have to worry about getting these configuration settings right. And also
for ImageJ to automatically update your SezPoz metadata for you, since
Eclipse only does it when you clean the project.
The Eclipse problems have been the subject of many discussions but there is
still much work to do to iron it all out.
Sorry,
Curtis
On Tue, May 15, 2012 at 3:46 AM, Michael Zinsmaier <michael.zinsmaier at gmx.de
> wrote:
> Dear Curtis and Barry,
>
> I am the new guy at KNIP and I am currently working on the ImageJ2
> integration. For KNIP it would be very useful
> if we could load Plugins/(Runnable Modules) during runtime such that a
> user could select a ImageJ2 Plugin directory and KNIP browses this
> directory and loads the respective plugins.
>
> To my knowledge this could basically be implemented by either manipulating
> the classpath or with ClassLoaders to
> make the additional jar files visible for the PluginFinder. However due to
> the eclipse plugin based KNIME architecture and the class.forName calls in
> ImageJ2 I don't get either of these options to work.
>
> Do you currently plan to support user defined Plugin folders in ImageJ2?
>
> I attached a sample of my ClassLoader code in case that there exists a
> simple solution that I missed (-:
> Furthermore I had some trouble while creating a test plugin for ImageJ2
> with Eclipse and I wrote down the learned lessons because this might be
> usefull for other users as well.
>
> regards Michael
>
>
> ClassLoader based sample Code:
> ------------------------------**--------------------
>
> I experimented with code like this:
>
> File f = new File("MySmallPlugin.jar");
>
> ClassLoader cl = null;
> try {
> ClassLoader prev = IJ2Modules.class.**getClassLoader();
> cl = new URLClassLoader(new URL[] { f.toURI().toURL() }, prev);
> } catch (MalformedURLException e) {
> e.printStackTrace();
> }
>
> final ArrayList<PluginInfo<?>> plugins = new ArrayList<PluginInfo<?>>();
> PluginFinder pf = new PluginFinder(cl);
> pf.findPlugins(plugins);
>
> I can find my new plugin like this however the ImageJ2 classes belong as
> far as I understand to the "prev" classloader and class.forName will thus
> not work in subsequent calls.
>
>
> Plugin creation with Eclipse:
> ------------------------------**----------------------------
> To do the experiments I created a simple Plugin with Eclipse and there are
> some pitfalls
>
> - one has to consider the Eclipse-specific notes of sezpoz (
> sezpoz.java.net -> Notes)
> - it seems that the sezpoz library has to be included in the buildpath of
> the pluginproject although eclipse will never ask for it (I think it might
> be used during the jar creation to generate the annotations folder in the
> jar file but this is just a guess)
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20120605/99eec3bd/attachment.html>
More information about the ImageJ-devel
mailing list