[Debian-med-packaging] imagej fails to run

Bob McGowan bob at bnlmcgowan.net
Sun Feb 21 02:16:19 UTC 2010


Due to not properly generating a JAVA_HOME when the variable is not
defined in the user's environment.

I happen to be running Kubuntu, so if I should be sending this to
someone else, let me know who.

The error, when running 'imagej', unmodified, on the command line, is:

    Open other images in this ImageJ panel as follows:
      imagej -p 1 <image1> [<image2> ... <imageN>]

    cat: /usr/share/imagej/jni/*: No such file or directory
    /usr/bin/imagej: line 418: //bin/java: No such file or directory

Dealing with only the line 418 issue, that line in the script file is:

    eval $JAVA_HOME/bin/java ${arch}

Since the error prints "//bin", it is clear that JAVA_HOME has been set
to '/' which is seen by the system as /bin/java.

But java is in /usr/bin.

Looking at where JAVA_HOME gets set in the script, I see:

  # This does not work see #505315
  # JAVA_HOME=$(/usr/sbin/update-java-alternatives -l | head -1 | cut
-d' ' -f 3)
  JAVA_HOME=$(dirname $(dirname $(dirname $(readlink
/etc/alternatives/java))))

This clearly doesn't work very well, either.  So I fixed it with:

    JAVA_HOME=$(dirname $(dirname $(readlink /etc/alternatives/java)))

which will leave '/usr' to prepend to '/bin'.

Now, the message is:

    Open other images in this ImageJ panel as follows:
      imagej -p 1 <image1> [<image2> ... <imageN>]

    cat: /usr/share/imagej/jni/*: No such file or directory
    Exception in thread "main" java.lang.NullPointerException
       at java.awt.Component.setDropTarget(libgcj.so.10)
       at ij.plugin.DragAndDrop.run(DragAndDrop.java:26)
       at ij.IJ.runPlugIn(IJ.java:148)
       at ij.IJ.runPlugIn(IJ.java:131)
       at ij.ImageJ.<init>(ImageJ.java:184)
       at ij.ImageJ.main(ImageJ.java:552)

I am not a Java programmer, and have no idea where to go from here. 
Perhaps it is the missing /usr/share/image/jni files?

Bob



More information about the Debian-med-packaging mailing list