[ImageJ-devel] importing custom "uncompressed" libraries (i.e., no JAR)

Gaetano Impoco gaetano at impoco.it
Tue Sep 16 04:54:40 CDT 2014


Hi Curtis,

> Could you please provide a minimal, complete, verifiable example
> demonstrating the issue?

I created a small example that requires my library (please, download it at
http://www.impoco.it/files/gijLib.jar)

-------------

import ij.*;
import ij.process.*;
import ij.plugin.filter.*;
import java.awt.*;
import java.awt.geom.*;
import gijlib.binary.*;
import gijlib.geom.*;


public class Example_ implements PlugInFilter
{
  public int setup(String arg, ImagePlus imp)
  {
    return DOES_8G;
  }

  public void run(ImageProcessor ip)
  {
    ContourFollower cf = new ContourFollower(ip);
    if(cf.getNContours() != 1)
    {
      IJ.error("The input image should contain one and only one object!\nFound
"+cf.getNContours());
      return;
    }

    Point[] contour = cf.getContour(0);
    Point2D cHull[] = ConvexHull.grahamsScan(contour);

    Line2D  diam    = PolygonUtilities.computeDiameter(cHull);
    Line2D  odiam   = PolygonUtilities.computeOrthogonalDiameter(cHull, diam);
    OrientedRectangle obbox = PolygonUtilities.computeBoundingRect(diam, odiam);
  }

}

-------------

When I put gijLib.jar in the "jars" directory and compile this class using the
--javac option of the ij2 launcher, everything is ok. When I uncompress the JAR
file into the "jars" directory, the compiler cannot find the classes in the
library.

Moreover, if I try to run a plugin that includes a class in the same directory
(but not using packages) the compiler fails, as well. I avoid this problem
using the option --class-path $HOME/Fiji.app/jars/

Hope I gave enough information.

Thank you
Gaetano




Quoting Curtis Rueden <ctrueden at wisc.edu>:

> Hi Gaetano,
>
> > In my brand new Fiji installation, I can import my library only if I
> > archive all .class files into a JAR file.
>
> IIUC, what you describe is still supposed to work.
>
>
> http://imagej.net/Bug_reporting_best_practices
>
> Regards,
> Curtis
>
> On Fri, Sep 12, 2014 at 6:05 AM, Gaetano Impoco <gaetano at impoco.it> wrote:
>
> > Dear all,
> > I developed a custom library for my own convenience that used to work in
> > ImageJ1.x. In my old IJ1 installation I used to add the library root
> > directory
> > to the Java CLASSPATH (using a simple bash script).
> > In my brand new Fiji installation, I can import my library only if I
> > archive all
> > .class files into a JAR file. I would like to use JARs only for
> > deployment. Is
> > there any way to include the "uncompressed" (development version) library?
> >
> > Thank you
> > Gaetano
> >
> >
> >
> > _______________________________________________
> > ImageJ-devel mailing list
> > ImageJ-devel at imagej.net
> > http://imagej.net/mailman/listinfo/imagej-devel
> >
>





More information about the ImageJ-devel mailing list