Using external libraries

It may happen that using only the ImageJ and the Java native classes is not enough to accomplish what you want to do. Perhaps you need advanced mathematical functions, similar to the ones that can be found on the excellent Apache Commons Math library (http://commons.apache.org/proper/commons-math/). While you may think that you should implement every single mathematical algorithm that your plugin is going to use, code reutilization is encouraged here, as it is a good principle not to reinvent the wheel and use well-tested libraries that already provide some of the functions that you need. As you saw during the Eclipse setup phase, it is very easy to add an external library and start using the classes provided by it. But, if you do that, how can you distribute your plugin once it is done?

You might have noticed a jars folder inside the plugins folder. That folder contains the .jar (or .class) files of the third-party libraries used by your plugin. You can use as many external libraries as you want, as long as you tell your users to download them into that folder. Then your plugin can be installed in the usual way and ImageJ will add that folder to the library path.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset