Edit page History How do I edit this website?

Using IntelliJ

The following instructions for debugging Micro-Manager’s Java code with IntelliJ are intended to work on Windows or Mac. Updated for 2.0-gamma

(See also: Writing plugins for Micro-Manager)

  1. Download and install a recent Micro-Manager nightly build. We will refer to the installed Micro-Manager directory as $INSTALLDIR below.

  2. Use git to clone the micro-manager source code 1. We’ll refer to the root source directory as $SRCDIR below.

  3. Download, install and run IntelliJ Community Edition. You may also need to download a JDK from AdoptOpenJDK. Micro-Manager is currently developed with JDK 8 (Java Development Kit 1.8).

  4. Choose Create New Project

  5. Name the Project (i.e. Micro-Manager2), and select the JDK (11 may work, but MM is developed with JDK8).

  6. Select the project and right click and find “Open Module Settings (F4)”.

  7. Click on “Add Content Root”. From $SRCDIR select mmstudio/src/main/java and mmstudio/src/main/resources

  8. In the Project Settings dialog, select “Libraries”. Use the “+” button in the second column to add libraries. If you have ant installed and ran ‘ant -f buildscripts\fetchdeps.xml before, add $SRCDIR/dependencies/artifacts/imagej, $SRCDIR/dependencies/artifacts/compile. If you did not, you can try adding the plugins/micro-manager directory of your micro-manager installation. You will also need to supply MMAcqEngine.jar and MMCoreJ.jar, which you either build yourself, or that can be found in $INSTALLDIR/plugins/micro-manager. Click “OK”

  9. in the IntelliJ menu, select Run > Edit Configurations. Add new Configuration, type “Application”.

#* Main Class: type in ij.ImageJ

#* VM options: type in -Xmx3000M. This sets the maximum memory (megabytes) used by Java .Also add -Dforce.annotation.index=true.

#* Working Directory: type in your $INSTALLDIR

  1. You should now be able to Run and Debug the code.

Explanation of the -Dforce.annotation.index option: Micro-Manager uses Scijava plugins for many of its internal components. In order for plugins to be detected at runtime it is important that the annotation processor is enabled. The -Dforce.annotation.index option will attempt to force to processor to be enabled. Often, that does not work. and you will get a NullPointerException on startup. If so, go to File->Settings->Build,Execution,Deployment->Annotation Processors and check the Enable annotation processing checkbox.

The components from the installed Micro-Manager can get out of sync with the source code. If you encounter unexpected errors, update to the latest nightly build and the latest source revision.