Java Plugin appears but does not do anything

Dear all,

I wrote a little plugin in IntelliJ and imported the .class file. The name of the plugin shows up in the drop down menu but when I choose it it does nothing. No error messages and for others with for example another JVM it shows error messages.

Is there a problem with the compiling from IntelliJ?

Thank you for your answers in advance!

Best wishes


Since you delivered no code I can only guess that you tested the *java plugin with the main method and maybe you didn’t implement the ImageJ plugin run method as the main entry point (when we talk about the PlugIn interface) public void run(String arg) which will be called when executing the plugin?

Everything else can be a wild guess without your source.

Thank you so much! I am new in writing Java and I made the mistake to have:
public class My_Plugin extends JPanel {
public static void main ( String Args){

and not:
public class My_Plugin implements PlugIn{
public void run (String arg) {


But now I have the problem that I cant compile since in the IDE (IntelliJ) I cant include the imageJ commands. I tried already this:
But it is somehow not working and I am very new in Java and a bit confused.
Does someone has another way?

Thanks a lot!

It would be helpful if you just showed us your code and the associated compiler errors, or even better posted the entire IntelliJ project somewhere in the cloud.

I understand you are working off this guide written by @ctrueden , who regularly monitors this forum, so you have indeed come to the right place to ask a question. We just need you to ask it in a specific manner so we can reply with a specific answer.

Here is my example I tried to run to test the workflow of java in IntelliJ:

And the errors I get:

What I dont understand is that I did that guide but IntelliJ dont recognize ImageJ packages in a new project.

You seem to writing a ImageJ 1.x plugin. In that case, I would checkout the legacy example project by cloning from git:// and then try building as is first. You can then modify it, replacing the code in the example with your code.

If you want to write a new plugin using the modern ImageJ API and are not interested in ImageJ 1.x compatibility, I recommend using this guide:

1 Like

Thank you so much! Is the second guide for programming in Fiji? And wenn I record some commands in the Fiji recorder and create the Java file I cant run it with IntelliJ…

I did the second guide and had a look at the examples offered. I am very confused how to to access for exmample the particle analyser.

Thank you a lot for your help!

Here you find a elaborate setup for ImageJ1 plugins and IntelliJ:

Good day Anna,

from the code snippet you’ve posted I see that you are going to code a classic ImageJ-plugin that works with plain ImageJ and Fiji.

Please be aware of these facts:

  1. Here is a guide that tells you how to do this with the compiler functionality of plain ImageJ
  2. This means that you don’t need any external IDE (IntelliJ) but you may lack certain conveniences of such
  3. The compiler functionality is still absent from Fiji
  4. You can use the macro recorder functionality of ImageJ with setting “Java” to get the desired code or at least code that gets you started
  5. Please re-think thoroughly if pure ImageJ-macro code would do for your purposes. As long as your code consists mostly of run(…) commands, an ImageJ-plugin provides no real advantage when compared to an ImageJ-macro but the latter are by far easier to write




Good day to you too Herbie,

Thank you a lot. I wrote my entire code as a macro and it reaches now levels where I need it as a java file with subclasses.

I really like to use IntelliJ since it offers a lot of functionalites like minimalizing for better overview of the code. My problem is that I know somehow the code I want to write but the IDE cant read it since I somehow cant use the imagej module.

I followed the instructions in the “Developing ImageJ in IntelliJ IDEA” and when I open a new project in IntelliJ and try to write code I got the errors in the uploaded images.

I think I got somewhere lost …

I wrote my entire code as a macro and it reaches now levels where I need it as a java file


I need it as a java file with subclasses.

How comes?
Since a macro can’t have subclasses, why do you need them for a plugin?

I really like to use IntelliJ

I code all my plugins using the compiler functionality of plain ImageJ and never needed an IDE.
I understand that you like to see some conveniences but if you are not successful with an IDE all conveniences are in vain – no?

I have no experience with ImageJ and IDEs, although I’ve done some Java-coding using Eclipse I never ever did plugin coding for ImageJ.

Why not just start writing your plugin using the compiler functionality of plain ImageJ instead of losing more time with struggling?



I think you are right… But now I cant open my ImageJ. Is is possible that one cant open it, when Fiji is installed too?
And where are the compiled files then stored?

Again thank you a lot for your help!

Please start with a very simple “Hello World”-plugin using the macro recorder with Java setting.

I’ve no problems with both ImageJ and Fiji installed.



I think it get’s more and more confusing for you. Just as a background. You can compile ImageJ1 plugins in different ways:

The easiest way to compile ImageJ plugins is to use the ImageJ1 editor as @anon96376101 mentioned and simply compile the plugins. The plugin will run in ImageJ and in FIJI.

If you plan to write a more advanced plugin I highly recommend to use a IDE like you already use. This is why I sent you the IntelliJ plugin link from the imaging book which has a nice setup by default, too (to test and ship the plugin).

However you could also built a ImageJ1 plugin with Maven as described by @markkitt if you are familiar with maven or wan’t to use maven for the built process.

Maven is also the way to go if you want to create ImageJ2 API plugins (FIJI only).

Note (only to mention all compilation possibilities):
I also wrote an application (Bio7) to compile ImageJ1 plugins dynamically (in process with class reloading) using the Eclipse editor (also the regular ImageJ mechanism is supported). This is very nice for testing ImageJ plugins on the fly.


Since I really rather use an IDE for overview reasons I did again the recommended side if Bio7. Just for a try I started Fiji and instelled the Demo_Plugin.class via Plugins/Install plugin. Restarted Fiji as well as executed it and I got this error:


Thank you all so much for your help!

In FIJI just copy the folder (my_plugins) with the *.class file to the plugins folder like in ImageJ.

You can also start ImageJ which is shipped along this setup.

Here I downloaded IntelliJ (I’m an Eclipse user but it is quite similar):

How it worked:

If I create a new plugin it is compiled to the selected folder (Compiled *.class file - don’t forget the package declaration of the folder)

I have to copy the plugin to the ImageJ plugins folder (Shipped ImageJ plugins folder) to test it (plugins/my_plugins)!

Start the embedded ImageJ (see screenshot - comes with the example) and test it.

Of course you can rename the folder name my_plugins to something more fitting, too.

I tried to Compiler the Demo_plugin and got this error:

I built the plugin with:


Since there is not main method in the plugin!

It worked finally!!
Reinstellen IntelliJ and follwed the recommended website in github!

Thank you very much for your patience and help!

1 Like