Login  Register

Re: Plugin for compiling all plugins?

Posted by Rasband, Wayne (NIH/NIMH) [E] on Jun 30, 2013; 2:05am
URL: http://imagej.273.s1.nabble.com/Plugin-for-compiling-all-plugins-tp5003613p5003709.html

On Jun 26, 2013, at 3:28 AM, Burger Wilhelm wrote:

> Hello Curtis,
>
> thanks - so I did! I set up a plugin 'My_Inverter' in package 'p1' (in <ImageJ>/plugins/p1/My_Inverter.java), pre-compiled by Eclipse to p1/My_Inverter.class.
>
> After launching IJ, the subfolder p1 correctly appears in the plugins menu and the plugin executes flawlessly. However, when I try a 'Compile and Run..' (either the .java or the .class file) I get the following error:
>
> -------------------------------------------
> Plugin or class not found: "My_Inverter"
> (java.lang.NoClassDefFoundError: My_Inverter (wrong name: p1/My_Inverter))
> -------------------------------------------
>
> Actually this is the behavior I remember. Could this be a class-loader problem?

This bug is fixed in the ImageJ 1.47v daily build.

-wayne


> ________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Curtis Rueden [[hidden email]]
> Sent: Tuesday, June 25, 2013 23:55
> To: Burger Wilhelm
> Cc: ImageJ Interest Group
> Subject: Re: Plugin for compiling all plugins?
>
> Hi Wilhelm,
>
>> Can plugins with packages also be used if the code is not contained in
>> a JAR file? Can they be re-compiled on demand, re-loaded and executed?
>
> Sure, give it a try. Just make sure the class name has an underscore in that case. It will be in a submenu named after the package.
>
> If you have any trouble with it, let us know.
>
> Regards,
> Curtis
>
>
> On Tue, Jun 25, 2013 at 2:17 PM, Burger Wilhelm <[hidden email]<mailto:[hidden email]>> wrote:
> AH, I was not aware that this was possible! Can plugins with packages also be used if the code is not contained in a JAR file? Can they be re-compiled on demand, re-loaded and executed?
>
> --Wilhelm
>
>
> ________________________________
> From: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Curtis Rueden [[hidden email]<mailto:[hidden email]>]
> Sent: Tuesday, June 25, 2013 20:52
> To: Burger Wilhelm
> Cc: [hidden email]<mailto:[hidden email]>
>
> Subject: Re: Plugin for compiling all plugins?
>
> Hi Wilhelm,
>
>> ImageJ plugins are not supposed to reside in packages
>
> Why not? As long as you have a plugins.config defining which classes are plugins, they can live in packages, and they do not need an underscore in the name. Perhaps that would make your life easier?
>
> Regards,
> Curtis
>
>
> On Tue, Jun 25, 2013 at 12:50 PM, Burger Wilhelm <[hidden email]<mailto:[hidden email]>> wrote:
> Hello Curtis,
>
> yes, the assumption is that I have a set of plugin source-files (.java) placed in multiple folders inside the 'plugins' folder. I thought of a command "Compile all..." command (similar to "Compile and run..") that simply compiles all these source files but does not run anything. Of course I guess one could also run javac from the command line.
>
> My IDE (Eclipse) is actually part of the problem. I wanted to distribute a structured set of plugins with .java and .class files side-by-side. My Eclipse project is already rooted at the ImageJ's plugins folder, each inner folder in 'plugins' is a source folder which is its own output folder - thereby .java and compiled .class files come to lie together, just as I want. However, since ImageJ plugins are not supposed to reside in packages - Eclipse cannot export these source folders to a JAR file other than as a flat container (removing all sub-folders). So I thought I let Eclipse only generate the source tree and then run the compiler over it with that intended ImageJ command. Weird idea?
>
> Thanks much for the hints, I think I'll try the command line approach now...
>
> --Wilhelm
>
> ________________________________________
> From: ImageJ Interest Group [[hidden email]<mailto:[hidden email]>] On Behalf Of Curtis Rueden [[hidden email]<mailto:[hidden email]>]
> Sent: Tuesday, June 25, 2013 17:33
> To: [hidden email]<mailto:[hidden email]>
> Subject: Re: Plugin for compiling all plugins?
>
> Hi Wilhelm,
>
>> does anyone know of way to (re-)compile all other plugins within the
>> <ImageJ>/plugins/ directory? Any hints appreciated...
>
> Presumably you have the source code for all such plugins in the plugins
> folder?
>
> You say "all other plugins" -- does that mean you want to recompile the
> other plugins from within a plugin of your own, at runtime? Or would it be
> sufficient to use something like "javac -cp '../jars/*' *.java" on the
> command line from the plugins folder?
>
> Regards,
> Curtis
>
> P.S. If externally recompiling is sufficient, but you don't like the
> command line, you could create an IDE project around your ImageJ folder,
> setting your plugins folder as the source folder, and all JARs in the jars
> folder as dependencies.
>
>
> On Tue, Jun 25, 2013 at 1:52 AM, Burger Wilhelm <
> [hidden email]<mailto:[hidden email]>> wrote:
>
>> Hello group,
>>
>> does anyone know of way to (re-)compile all other plugins within the
>> <ImageJ>/plugins/ directory? Any hints appreciated...
>>
>> --Wilhelm
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html