Re: Javascript in Fiji does not work anymore
Posted by
Jan Eglinger on
Jun 19, 2014; 2:22pm
URL: http://imagej.273.s1.nabble.com/Javascript-in-Fiji-does-not-work-anymore-tp5008314p5008317.html
Hi Christophe,
On 19.06.2014, 2:33 PM, Christophe Leterrier wrote:
> With the current up-to-date Fiji, my javascripts do not run anymore. When I
> try to launch them directly from the plugins menu, nothing happens. When I
> open them in the Fiji editor and run them, I get reference errors for
> basically every command :
>
> IJ.log("hello");
> fails
>
> var gd = new GenericDialog("test");
> fails too.
>
> Here is the error I get with IJ.log:
>
> Started ProFeatFit_3.js at Thu Jun 19 14:29:33 CEST 2014
> javax.script.ScriptException:
> sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "IJ" n'est
> pas défini
You get these errors because the classes of the ij.* package are not
imported by default any more by the script editor.
I just discovered that there is an option to switch the auto-imports
back on: in Fiji's script editor, go to:
*Edit > Auto-import (deprecated)*
In any case, it might be a good idea to not trust the auto-imports but
import the classes you need explicitly:
importClass(Packages.ij.IJ);
importClass(Packages.ij.gui.GenericDialog);
Hope that helps,
Jan
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html