Posted by
Daniel White on
Oct 15, 2014; 8:18pm
URL: http://imagej.273.s1.nabble.com/Run-native-executable-in-a-plugin-Apache-commons-exec-or-processbuilder-tp5010068p5010071.html
Hi Dschowe,
On Wednesday, October 15, 2014, Johannes Schindelin <
[hidden email]> wrote:
Ah! Jolly good!
>
> Both classes are available as part of Fiji. The main difference is that
> the SimpleExecuter logs the output of the command to the Log window, while
> the ProcessUtils return the output as a String. Here is a simple BeanShell
> script demonstrating both (the /bin/echo command is available on Linux and
> on MacOSX, on Windows you need to use something else):
>
> fiji.SimpleExecuter.exec(new String[] {
> "/bin/echo", "Hello, Dan!"
> });
> out = org.scijava.util.ProcessUtils.exec(null, null, null,
> new String[] { "/bin/echo", "Hello, Dan!" }));
> ij.IJ.log(out);
>
>
> Great!
So if the eg. Linux executable might take a long time to run, Should I
also make sure it can be killed if it hangs or times out , and somehow
catch its successful completion signal... To know when I can then get
imageJ to load the result image file, if I want the plugin to also do that.
Should I also make sure the executable runs in a different thread to the
GUI? So it doesn't block important stuff?
what to watch out for to make sure the plugin could also be run in a
headless situation ? Separate the GUI from the part that does the execution
I guess...
And to make sure the plugin can be run in batch mode via the multi image
processor, or what ever it's called these days....
Dos and don'ts to make sure it's as general as possible?
D
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html