Login  Register

Re: Organizing plugins, utility classes and jars

Posted by Michael Schmid on Aug 27, 2009; 10:16am
URL: http://imagej.273.s1.nabble.com/Organizing-plugins-utility-classes-and-jars-tp3691373p3691374.html

Hi Ben,

two remarks:

In your approach, there is no need to remove the .java files from the  
plugins subdirectories; it is enough to remove the .class files that  
are now in a .jar
ImageJ won't compile .java files unless they are needed for  
'Compile&Run'

--
My usual approach for editing a larger package is copying the  
directory with the sources as a whole into the plugins folder, moving  
the jar somewhere else (actually, I name it .zip; ImageJ accepts  
also .zip in place of .jar; the advantage is that one can more easily  
add/replace files in a .zip, at least under Windows).
Then I do the changes until everything works; and I copy the  
new .class files into the zip (jar) and I move the new sources back  
to my home directory. Finally, I delete the remaining class files and  
put the zip (jar) file back into place.

You can have a plugins.config file in the jar to specify which  
plugins should appear in the menu and where.
   http://rsb.info.nih.gov/ij/plugins/jar-demo.html

I have this plugins.config file together with the sources, so I can  
also create a new zip from the whole subdirectory of the plugins (and  
remove the sources afterwards if desired)
I have a flat folder, no hierarchy, however; possibly this won't work  
with subfolders.


Michael
________________________________________________________________

On 27 Aug 2009, at 02:52, Ben Tupper wrote:

> Hi,
>
> I have been (finally) getting to the point in ImageJ where I have  
> collected suites of utility classes and plugins. Suppose that I  
> have in the /plugins folder (a) folder of a menu-based plugin plus  
> supporting utility classes, (b) a folder of utility classes, (c) a  
> folder of a menu-based plugin than wants to use utilities from A  
> and B, and (d) a folder called jars.
>
>
> /plugins
> /pluginA (a plugin plus supporting classes)
> PluginA_.class (the plugin to ImageJ)
> UtilityA1.class
> UtilityA2.class
> /utilityB (utility classes)
> UtilityB1.class
> UtilityB2.class
> /pluginC
> PluginC_.class (wants to use utilities in A and B)
> /jars
>
>
> My habit at this point is to create jars of the utilities within A  
> and B, place them in the /jars folder, and finally remove the  
> original code and classes so ImageJ finds only the jars.  Creating  
> the jar in A is a little tricky because I don't want to place the  
> menu-based plugin "PluginA_.class" in the jar.  It seems a little  
> clunky (and perhaps risky) to move the code in and out of the  
> ImageJ/plugins directory.  It certainly is a pesky process when  
> developing in directory C requires modifying the code in A or B.
>
> Is there a conventional way to manage this process that requires  
> less effort and risk on my part?
>
> Thanks!
> Ben
>
> Ben Tupper