IJ2 is out
 Sec. 14: Macros Up Part III: Extending IJ Sec. 16: Plugins 

15 Scripts

JavaScript scripting was introduced in ImageJ 1.41 in order to bring full access to ImageJ and Java APIs (see Advantages and disadvantages of JavaScript↓). ImageJ uses the Mozilla Rhino interpreter built into Java 1.6 for Linux and Windows to run JavaScript. Mac users, and users of earlier versions of Java, must download JavaScript.jar into the plugins folder. This JAR[?] file is available on the ImageJ website and is included with the Mac version of ImageJ in ImageJ/plugins/jars.
Example JavaScript programs are available at imagej.nih.gov/ij/macros/js/. Thread safe JavaScript code can be generated using the Recorder (PluginsMacrosRecord…↓). Scripts can be opened in the editor as any other macro. Scripts with the extension .js can be run using MacrosRun Macro otherwise MacrosEvaluate JavaScript (Ctrl J) must be used.

JavaScript Programming

Resources on ImageJ JavaScript scripting include:
  1. The ImageJ web site, with growing documentation:
  2. Tutorials on the Fiji webpage:
  3. Online scripts repository:
Table 1 Advantages and disadvantages of JavaScript in ImageJ. A thorough comparison between different scripting languages is available on the Fiji webpage.
JavaScript Advantages JavaScript Disadvantages
Full access to ImageJ and Java APIs Slower, especially starting up
Standardized No equivalent of macro sets
Richer language (objects, ? operator, break, continue, etc.) Cannot use most of ImageJ’s 360+ built in macro functions
Extensive documentation Requires knowledge of complex ImageJ and Java APIs
No support for “batch mode”
Cannot create Custom Tools↓ and toolbar menus
Not compatible with Function Finder… [F]↓ and CodeBar [H]  [H] CodeBar is a convenient ‘ActionBar’ that retrieves snippets and common tasks frequently used in macro writing. ‘ActionBars’ provide one or many easy to use button bar(s) that extend ImageJ’s graphical user interface. You can read more about the ActionBar plugin at the ImageJ Documentation Portal.
No debugger
 Sec. 14: Macros Up Part III: Extending IJ Sec. 16: Plugins