Plugin installation not working for MicroManager 1.4 on Windows and Mac

Hello,

I followed the instructions to develop a plugin using Netbeans to use with Micro Manager. I just used the helloworld plugin as a test. It compiled and built correctly. I dropped the .jar file in the mm plugins folder, but when I restart Micromanager, the plugin was not in the Micromanager plugin menu.

Some other things I tried:

  1. I tried dropping it in the Acquisition Tools folder (and other menu folders just as a test), and it didn’t show up there
  2. I tried installing it using the ImageJ Plugin installer and it didn’t show up there either.
  3. I created the MMStartup.bsh file as described here: https://micro-manager.org/wiki/Writing_plugins_for_Micro-Manager

I have never had trouble with writing/loading plugins with FIJI, but for MM/ImageJ, it never works as expected. I tried this process both on a Windows computer and a Mac computer, both x64 with the right MM installation. Another user experienced the same problem (in the old mm mailing list), but it was not resolved there:
http://micro-manager.3463995.n2.nabble.com/Plugin-installation-td7587192.html

What do you suggest?

Thanks,
Sommer

Sommer,
I’m sure Nico will chime in, but in the mean time, consider sharing what
environment you are using to do the developing.

If you are using Eclipse, there are a couple of hints in the old list
that might help, one reproduced here:

FTR,
the plugin loading mechanism of Micro-Manager (and ImageJ) uses services
from the scijava class, that in turn use annotations.
Those annotations should be in the jar file as a consequence of running
so called processors, which eclipse do not run by default.
That makes the jar files generated by eclipse “transparent” to the
loading system.

If you want to know more, google is your friend with keywords eclipse,
annotations, scijava.

The issue can be dealt with in a number of ways. Maven and Ant seem to
have building systems aware of processors.
If you, like me, do not use either, there is a Git repo:
https://github.com/scijava/eclipse-scijava-project
that shows how to deal with this.

HTH,
-Carlos

Sommer via Image.sc Forum @ 18/08/2020 14:32 -0300 dixit:

As I mentioned in my message, I used Netbeans to make the plugin. I looked into annotations and can not find a specific one for scijava. I looked at the code and build.xml file for the HelloWorld sample plugin, which did properly load, and I could not find where/how scijava was integrated. When developing plugins for FIJI, I use Maven in Eclipse, which enables org.scijava to be imported. When I try loading a plugin with a similar import to MM, ALL plugins fail to load.

How do you recommend loading scijava in Netbeans? I have annotations turned on.

Additionally, I tried following the instructions here: https://micro-manager.org/wiki/Writing_plugins_for_Micro-Manager
to try to build the helloworld plugin myself using Netbeans, and that didn’t work either. I think it may have to do with the ij.ImageJ class not being found (I entered in manually in the window screenshot below), despite having loaded the necessary .jar files in the compile time libraries. I had the same problem using Eclipse, although I have had no issue when using Eclipse to write plugins for FIJI.

Might this be the problem?
I know those files are loaded because when I debug the project, MM launches, but my plugin is not in the MM plugins menu.

I think (but not 100% sure) that 1.4 does not use annotations, whereas 2.0 does. At this point, it is highly recommended to develop for 2.0. We will likely stop building and distributing 1.4 soon.

To debug a plugin, it first needs to appear in the menu. Therefore, you will first need to build a correct jar and copy that to the mmplugins folder of your MM runtime (application). It may be possible to do that in your IDE, but I find it harder to figure out how the IDE builds jars (I doubt that the jar that Netbeans build for you is correct) and where it puts them than just building the jar directly.

B.t.w., if ij.ImageJ was not found in your “Run” tab, you most likely did not include ij.jar in the previous step.
On Windows, install and configure ant. Run ant in your plugin directory. This may also work on Mac/LInux, but usually it is easier to use the “make” command (although you will need to configure your environment correctly).

Thank you for the suggestion. I also thought that was the problem, but I did have ij.jar added. I was able to get it to work (in debug mode in Netbeans) by performing the steps below.

However, when the plugin is in the mm plugins folder, the MM window of IJ fails to launch. Why do you think this is happening?

  1. Creating a new project with the source directory as the plugins folder of the MM source code to access build scripts.
  2. Using the two imports below in the build.xml file. The first is included as default with Netbeans. The second is from the build.xml file from any plugin in the source code.
 <import file="nbproject/build-impl.xml"/>
 <import file="../javapluginbuild.xml"/>
  1. In order to get the second import to work, you need to navigate to the project folder (in the source code plugins folder) and run ant -f buildscripts/fetchdeps.xml from the command line. I did not have ant, but was able to install it from the mac command line using brew install ant.

Once I built and cleaned the code, and ran it in debug mode, the plugin showed up and worked as expected. As I mentioned, it does not work outside of netbeans (when I drop it into the application’s plugins folder and launch from there).

For anyone still following this thread: I tried Maven and several other approaches. I have some follow-up questions and a solution. Let’s start with the solution:

Solution
Unfortunately, I kept experiencing the same problems with the Netbeans IDE as I described above (plugin working in debug mode, but MM not loading ANY plugins when I put a new one in the mmplugins folder and ran ImageJ from my applications folder).

I tried using a lab computer to recreate my problem. I experienced the same problems with Netbeans. However, I noticed the jre folder in the MicroManager1.4 folder. I had looked for this when trying to set up with eclipse on my other computer, but it was nowhere to be found. I then used the Eclipse setup instructions (after downloading Eclipse Kepler). This allowed the plugin to be used in debug mode, and in ImageJ outside of Eclipse with the plugin in the mmplugins folder. Wonderful!

So then I thought I could use Eclipse on my original computer now that I had the jre file. I followed the same steps, except in Eclipse Neon, and a main class kept being detected when I set up the Run/Build configuration, and then not detected at run time. I kept getting an odd error message reading “The currently displayed page contains invalid issues” when I changed the compliance to 1.6. I tried to install Eclipse Kepler, the same one I used on the lab computer, but it failed to open, perhaps because it was an older version. I tried using Mars, which I was able to open on my computer, but ran into odd file permission issues for the jre that prevented debugging and running.

At the end of the day [read: week], I have a working setup for MM plugin development that, for some reason, only works on one computer. Which leads to these followup questions:

Follow up questions

  1. Why is the jre folder not included in the version of MM that I installed? I installed the latest 1.4 for Mac OS and it was not there.

  2. Furthermore, is this the missing piece that caused plugins to not work when they were developed using the Netbeans instructions? Also, Netbeans 7.3 is not even available for downloads. I know MM 1.4 will no longer be supported, but these instructions should be updated for the time that it is supported to avoid the issues that myself and others have run into.
    If you do recommend Maven and it does make things easier, as suggested, there should also be instructions for Maven with the appropriate pom.xml specifications.

Sorry, meant to write “ant” instead of maven. Updated the comment above.

As for #1, MM 1.4 relies on Java 1.6, which used to be installed by default on Mac OS. If I remember correctly, this is no longer the case, and you will need to install a JDK/JRE yourself. One of the many reasons to no longer use MM 1.4 but 2.0 instead(which used JDK 8, which itself will soon go out of maintenance).

As for #2, please feel free to update the documentation. The website is a wiki. Request and account and let me know that you did so.

I somehow feel responsible, and do my best to keep things working and documented in my spare time. If you mean with the word “should” that you really should do this yourself, then great. If you mean that I should be doing this, then not so great.

I did end up installing JDK 1.6 for Mac and had to use this workaround to do so:

It was still not enough to get the plugin to work the way it did on a Windows computer.

I’d be happy to update the documentation. I requested an account with the same username I have here on Image.sc.

Is this the problem?

Look at the Micro-Manager logs (in the Corelogs folder). It will list the plugins it finds when it starts. There are various reasons why a plugin is not listed, for instance, it could be that you compiled your plugin for Java 8, whereas you are using Java 6 at runtime (JVMs are backwards compatible, but not forwards compatible). Or the jar that Netbeans/Eclipse produced is incorrect. In fact, your observation that no plugins at all are shown in the menu demonstrates that your jar crashes the thread that is loading plugins. There most likely is a stack trace in the Corelog that will give a clue about the underlying problem.

1 Like