Modify and debug existing plugin in IDE

Hi everyone,

I have quite a bit of experience with programming in general, but now I wanted to take a stab at modifying an existing fiji plugin using Netbeans. I have no problem getting the plugin code from github and into Netbeans. I can even modify it, compile it and add it to the plugin folder to run it in my copy of fiji.
My main problem setting it up so I can debug the modified plugin in netbeans using breakpoints.

I have looked at the available online documentation, but most info seems to be outdated or not very elaborate. So what would be the best way to set this up?

I’m currently working on the plugin code only, so I need some sort of main class to call the plugin from and pass info to it.I found some documentation on fiji-lib,, but I don’t seem to be able to get it to work. Maybe I’m missing some crucial piece of info?

If anybody could give me a clear (dummi-proof) step-by-step explanation on how to configure this, I would be most grateful. :slight_smile:


UPDATE: I made some progress in getting the fiji-lib to work (I think I broke some maven link in my POM earlier) . I put a basic main class in the test package and this now starts up fiji for debugging in netbeans. It just doesn’t seen to find my plugin which is in the main source package(Gives an ‘unrecognised command’-error) . Any suggestions on how to formulate the Debug.runFilter() correctly?

Hi @ljanssen86,

How specifically are you trying to run your Command plugin? imagej.command().run(MyCommand.class, true, input, input2...)?

Best regards,

Sorry, read your text further. I guess you’re trying to create an ImageJ1 style plugin.
Couple of things to check

  1. Have added your plugin to the plugins.config file in src/resources?
    It should look like: Plugins>My plugin, "My plugin", org.package.my_plugin
  2. Make sure that the .jar that contains your plugin class has an underscore in it. You can configure this from your POM with:

Thanks for the tips I think both are fine.
I can build the code I have and when I put the compiled file in the plugin folder the basic code runs when i start fiji normally.

I’m basically modifying the Auto threshold Plugin. I named my version: Auto Threshold2.
So in my main class I have:

public static void main(String[] args){
      Debug.runFilter("C:/Users/ICT Support/Desktop/stitched images/ThresholdTest.jpg","Auto Threshold2", null);

I gave null for the final parameters, because the first thing the plugin does is show a dialog for user input.
As I mentioned this main class is in the test package, but I don’t know if that makes a difference?

any more suggestions?

Have you tried IJ.runPlugIn(MyPlugin.class.getName(), argumentString);? If that doesn’t work, see how to plugins.dir property is set in the minimal IJ1 plugin example:

No joy, I’m afraid…

Hm, I’m stumped, could you provide the essential snippets of your POM and maybe a screenshot of your environment, please?

I managed to get the code running without the debugging, but I would still like this option in the future.
can you get the information you need fro these screenshots?

again any help would be much appreciated!