Skip to content

Latest commit

 

History

History
75 lines (55 loc) · 2.84 KB

File metadata and controls

75 lines (55 loc) · 2.84 KB

Practical 4 : Building a Fiji plugin

In the last practical, we've seen how to create a Fiji plugin which is runnable on IntelliJ.

In this practical, we'll see how to export the plugin to a .jar file and to make it run in any Fiji app.

Building the plugin

Building a plugin simply means creating a .jar file of the project. This jar contains the compiled code (i.e. bytecode with .class extension) of your project. This packaging can be read by any computer with a decent Java installation

To generate the .jar file

  • Go under maven -> intelliJ-workshop -> Lifecycle and double-click on install This will launch the compiler.
  • Once the compilation phase in done, a target folder is created in the project folder. This folder contains bytecodes and the plugin.jar. To open the location of this folder, you can do a right click -> Open in -> Explorer/Finder.

Note: In the target folder, you'll find two .jar file.

  • plugin.jar
  • plugin-sources.jar

We are only interested in plugin.jar

Have a look to the name of the .jar file

  • intellij-workshop: the first part corresponds to the artifactId you've set in the pom.xml
  • 1.0.0: this second part corresponds to the version number declared in the pom.xml

Adding a new plugin in Fiji

Now the plugin is built, we need to add it in Fiji to be able to use it.

  • Browse your Fiji.app folder

On Windows, you should have installed it under C:/Fiji.app.

On Mac, you should have installed it under the Application folder. Right-click on the Fiji logo and click on Show package content.

  • Drag-drop the plugin.jar file inside the Plugins folder of Fiji.
  • Start or restart Fiji.
  • Open the blob image
  • Go under Plugin -> IntelliJ_Workshop -> FloodFiller and run the plugin

An error message appears, telling you that the Label2ROIs class cannot be found. What can be the cause of this issue ?

This is because the Fiji you are using doesn't include the LaRoMe dependency we've added to the code. Fiji doesn't interact with IntelliJ.

In order to solve this issue, we need to add this dependency in Fiji as well.

  • Find the online GitHub repository of the dependency
  • Follow installation instructions.
  • Restart Fiji
  • Test again the plugin ; it should work.

Note: When you are developing some new code, it is very important to pay attention to what dependencies you are using. Are those dependencies available online ? Are they versioned ? Where can we find them ? Are they maintained over time ? Are they compatible with the tool I'm using/the app which will host it ?... All those questions should be addressed if you would like to have a stable and long-term tool.