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)
Download and install a recent Micro-Manager nightly build. We will refer to the installed Micro-Manager directory as
Use git to clone the micro-manager source code 1. We’ll refer to the root source directory as
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).
Choose Create New Project
Name the Project (i.e. Micro-Manager2), and select the JDK (11 may work, but MM is developed with JDK8).
Select the project and right click and find “Open Module Settings (F4)”.
Click on “Add Content Root”. From
$SRCDIRselect mmstudio/src/main/java and mmstudio/src/main/resources
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/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”
in the IntelliJ menu, select Run > Edit Configurations. Add new Configuration, type “Application”.
#* Main Class: type in
#* VM options: type in
-Xmx3000M. This sets the maximum memory
(megabytes) used by Java .Also add
#* Working Directory: type in your
- 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.