Edit page History How do I edit this website?

Writing plugins for Micro-Manager

This documentation is for the current version of Micro-Manager (2.0). For Micro-Manager 1.4 plugins, please see Writing plugins for Micro-Manager-1.4.


Writing a new Micro-Manager plugin involves two steps. First, you will write, test and debug your code. It is easiest to do this using a “Integrated Development Environment” (IDE) such as NetBeans, Eclipse or IntelliJ. Each IDE can be used to build plugins so that they can run on the computer they were written on without any additional steps. Since the Micro-Manager developers all appear to be using IntelliJ, you will find better documentation and support for that IDE than the others.

If you think your plugin will be useful to anyone besides yourself (or if you want to use it on a computer other than the one you developed it on), you will likely want to distribute the plugin in the form of a .jar file that can simply be copied into the mmplugins folder and be recognized by Micro- Manager. Micro-Manager 2.0 uses SciJava’s plugin discovery mechanism. This uses Java annotations that need to be generated by your build environment. Currently, we have no idea how to do that from an IDE, so the following instructions (based on work by SophieH) will help you use a command-line tool to build plugins that can run in Micro-Manager 2.0. If you figure out how to do this completely within an IDE, please contribute your notes!

Setting up to write, debug and package plugins

Download and install a recent version of Micro-Manager.

Downloaded and install a Java JDK. Micro-Manager currently is build with JDK8, which can be freely downloaded from Adoptium.

Download and install your IDE of choice.

Clone the Micro-Manager github repository. Optionally run the command git submodule update --init --recursive which will clone all submodules (currently the Core and devices, which you will not need to build a Java plugin).

Use the IDE to write and debug your plugin code (follow the links to the NetBeans, Eclipse or IntelliJ pages for IDE-specific instructions). If you only want to run your plugin on the machine it was developed on, you do not need to proceed past this point.

Building a redistributable .jar file

These instructions will allow you to compile your code for distribution. Note that these instructions will only work on Windows.

First, download and install Apache Ant.

You will need to set the following environment variables. On Windows, they can be added in Control Panel > System and Security > System > “Advanced system settings” > “Environment variables…”.

  • JAVA_HOME: set to the path to your JDK installation, e.g. C:\Program Files\AdoptOpenJDK\jdk8u181-b13. Do not add quotes to the value, even if it contains spaces.
  • ANT_HOME: set to the path to your Ant installation (whereever you placed the extracted binary package), e.g. C:\apache-ant-1.9.16. Do not add quotes to the value, even if it contains spaces.
  • PATH: It is convenient to add Ant to the command search path. You can append ;%ANT_HOME%\bin to the end of the System PATH varialbe, or add a User variable named PATH and set its value to %PATH%;%ANT_HOME%\bin.

Verify that the Environment Variables were set correctly and Ant is working properly by typing ant -version. You should get a reply similar to: Apache Ant(TM) version 1.9.16 compiled on July 10 2021

In your terminal application (I use Git bash), cd to the root of the micro-manager source code and ran the two following commands:

ant -f buildscripts/fetchdeps.xml
ant build-buildtools

Copy files from binary installation of Micro-Manager If you had not yet done so, download and install a recent version of Micro-Manager. Copy the following .jar files from that Micro-Manger installation into the build\Java folder, which is located in the micro-manager source code folder you cloned (the build\Java folder should already contain the file AntExtensions.jar):


Build and run your plugin code Change directory to micro-manager\plugins\Example, and issue the command ant jar. This should result in a file Example.jar in the build\Java\plugins directory. Copy this jar file to the mmplugins folder of your Micro-Manager installation and it should appear in the menu and work.