Login  Register

ImageJ (IJ.jar) used as library for a Java app fails when run from a script

Posted by Robert Lockwood on Mar 17, 2015; 6:03pm
URL: http://imagej.273.s1.nabble.com/ImageJ-IJ-jar-used-as-library-for-a-Java-app-fails-when-run-from-a-script-tp5012020.html

I use ij.jar as a library to covert my camera data which is an array of
unsigned shorts representing a monochrome image which I get directly from
the camera using Java apps.  I use ImgeJ to save the data to file as 16 bit
unsigned PNG and as false color image after applying a LUT.

The small suite of apps are designed to start automatically when the LINUX
computer finishes booting.  No monitor or keyboard will be present.

In development when the computer starts I then log in and start Gnome to
get a window.  Running from Eclipse works.

Without Eclipse I can run my exported jar (using a script) from a terminal
and it works
If at boot I log in but don't start Gnome and run the script it fails and,
of course it fails if I set the script to be run automatically at the end
of the boot process.

The failure occurs when IJ tries to save the file:

  IJ.saveAs(imp, "PNG", imageFullPathName);

The error is: 'Unrecognized command: "PNG..."'

I hope that this failure is not due to the fact that the window system
(Gnome) has not been started.

I export my app as a "Runnable Jar File" and choose "Package require
libraries into generated jar"

My build path for Libraries points to ij.jar.

Have I missed something in my Eclipse project configuration for using IJ or
exporting the app?






One's first step in wisdom is to question everything - and one's last is to
come to terms with everything.

Georg C. Lichtenberg

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html