fairSIM (ImageJ plugin) development: Beginner's setup questions

Hi everyone!

I’m new to development using ImageJ and a plugin called fairSIM. I am having some difficulties just getting started with it, and I was hoping someone here could get me started more quickly. :smile:

I’m using an up-to-date Arch Linux system using Java 1.8.0_92 and ImageJ 1.51d, and here are the exact steps for reproducing the issues I’m facing.

mkdir -p ~/test; cd ~/test; git clone https://github.com/fairSIM/fairSIM.git; cd fairSIM; make;

That makes a directory/folder called test in my home directory. It checks out the latest git release, goes into the directory with the Makefile (see the default Makefile here), and runs make.

Problem: The result of that is a compilation error because the Makefile bizarrely expects a program called javac6 to compile the code instead of just javac.

Solution: So, after a minor change of the Makefile by replacing javac6 with javac (the Java compiler executable), I ran make again.

Problem: This time, it tries to compile, but I got a bunch of errors related to ImageJ packages not being found.

Solution: So, I copied the ImageJ JAR file (ij.jar) into ~/test/fairSIM/ (via cp /usr/share/imagej/ij.jar ~/test/fairSIM/ij.jar) and modified the classpath of the Makefile with JFLAGS+= -cp ~/test/fairSIM/ij.jar (see amended Makefile).

Problem: Then, I re-ran make. This time, I encountered many fewer errors (see here). I don’t know how to get rid of these. Any advice?

Problem: I decided to ignore these errors and create a JAR anyway by running
cd ~/test/fairSIM/; make jar
The result is this. So, I still get an error. How can I fix this error?

Problem: I decided to use the resulting fairSIM_plugin_f69908170c.jar file as a plugin with the imagej I had installed on my system through my software package manager (the usual way of installing stuff on Linux). I ran imagej and clicked Plugins > Install... which prompted a file chooser menu. I selected ~/test/fairSIM/fairSIM_plugin_f69908170c.jar. Imagej then gave me another file chooser menu to specify where to save this plugin (bit bizarre architecture to me to do this). So, I specified ~/.imagej/plugins/ as the directory/folder to save fairSIM_plugin_f69908170c.jar into. This was already the default. I hit Save and navigated to Plugins > fairSIM > new reconstruction but ImageJ gave me an error.

Plugin or class not found: "org.fairsim.fiji.FairSIM_ImageJplugin" (java.lang.ClassNotFoundException: org.fairsim.fiji.FairSIM_ImageJplugin)

This is critically important to me that this gets resolved. What must I do to fix this?

Solution: This isn’t a real solution, but just a demonstration of what works and what doesn’t. Using a fresh, clean installation of ImageJ, I downloaded the fairSIM plugin JAR file from the fairSIM website (see here). That works perfectly fine. But, since I want to modify the code and use a modified fairSIM plugin, this won’t be an acceptable “solution.” I hope someone here can help me out!

Thanks in advance!

I strongly urge you to use Maven instead of struggling with an overly complex Makefile. See the Maven page, and the minimal-ij1-plugin example project.

Edit: I guess this is not your plugin? So maybe file an issue in their GitHub repository, then.

By the way, those compile errors are due to a missing JTransforms dependency. If the plugin developers used Maven, this would be a non-issue, as the dependency would be declared in the POM.

1 Like

You are right. This is not my plugin. I am seeking to modify it for my own needs.

If Maven is your recommendation, Maven is what I will use. I had created what I had thought to be a complete Ant build.xml file to fully recreate all the features of the Makefile with none of the issues. But, since I couldn’t get the resulting JAR file to work with ImageJ the way the precompiled JAR file hosted on the fairSIM project website works, I decided to keep it as simple as possible with a very easy to reproduce setup straight from the upstream developers. Just to double check, any preference between Ant build files and Maven? I’m new to both and open to learning more about both.

Thank you for bringing up the cause of the compile errors. I wasn’t able to resolve them, unfortunately. I’ll speak with the developer of fairSIM directly and add any feedback here.

Thank you for your input!

1 Like

Hi @yusuf2fairsim,

I have migrated a tool from the FairSIM suite to Maven a while ago. You could use my POM and take a look at what I have done to make the project conform to Maven requirements in the commit.

With respect to your original issue, which JDK are you using (Oracle or OpenJDK)?



Hi @stelfrich,

Thanks for your template. I’ll take a look. +2 for Maven.

In the chatroom, you also mentioned that the JTransforms issue may be key to fixing the compile-time issues. I think you are right, and I will keep trying to isolate the problem further. You did also bring up the concern of Java versions. I am using the Oracle JDK.

You should copy the ij.jar into the external/ folder and undo you JFLAGS changes. This way, running make only revealed minor warnings for me, which can be ignored for now.


That is exactly what was needed! I ran make jar after that and the resulting JAR file not only installs with no fuss, but it actually works as intended. This is a great starting point. Now to Mavenize this Makefile! Thank you very much! :smiley:

1 Like