Posted by
Michael Schmid on
Feb 26, 2009; 9:03am
URL: http://imagej.273.s1.nabble.com/Java-Compile-Errors-tp3693536p3693545.html
Hi David,
it seems to be a problem of 'convert to plugin'.
Rename should be
run("Rename...", "title=[test]");
or, if you have a variable,
run("Rename...", "title=["+newName+"]");
For the Image Calculator, simply delete the 'IJ.imageCalculator'
line; the one with 'IJ.run' is enough.
Michael
________________________________________________________________
On 25 Feb 2009, at 20:49, David William Webster wrote:
> I was just checking out the capability of converting a
> Plugins/Macro/Record macro to a plugin, but get errors when I use
> File/Compile and Run. I am Java ignorant so I don't know what gives.
>
> My recorded macro is:
>
> run("Duplicate...", "title=tim-1.bmp");
> rename("test");
> run("Mean...", "radius=2");
> imageCalculator("Add create", "tim.bmp","test");
> //run("Image Calculator...", "image1=tim.bmp operation=Add image2=test
> create");
> selectWindow("test");
>
> The Java code is:
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
>
> public class test2plugin_ implements PlugIn {
>
> public void run(String arg) {
> IJ.run("Duplicate...", "title=tim-1.bmp");
> IJ.rename("test");
> IJ.run("Mean...", "radius=2");
> IJ.imageCalculator("Add create", "tim.bmp","test");
> IJ.run("Image Calculator...", "image1=tim.bmp
> operation=Add image2=test create");
> IJ.selectWindow("test");
> }
>
> }
>
> and the errors are:
>
> C:\Program Files\ImageJ\plugins\test2plugin_.java:11: cannot find
> symbol
> symbol : method rename(java.lang.String)
> location: class ij.IJ
> IJ.rename("test");
> ^
> C:\Program Files\ImageJ\plugins\test2plugin_.java:13: cannot find
> symbol
> symbol : method imageCalculator
> (java.lang.String,java.lang.String,java.lang.String)
> location: class ij.IJ
> IJ.imageCalculator("Add create", "tim.bmp","test");
> ^
> 2 errors
>
> I just now took an automatic update for Java (1.6.0_10 [32 bit]),
> could
> this be the problem? Sory for being so clueless.
>
> David Webster