Login  Register

Re: Using System.out and System.err from ImageJ plugins (Java)

Posted by dscho on Feb 27, 2013; 9:44pm
URL: http://imagej.273.s1.nabble.com/Using-System-out-and-System-err-from-ImageJ-plugins-Java-tp5001799p5001907.html

Dear Wayne,

On Wed, 27 Feb 2013, Rasband Wayne wrote:

> On Feb 27, 2013, at 3:29 PM, Johannes Schindelin <[hidden email]> wrote:
>
> > On Wed, 27 Feb 2013, Rasband, Wayne (NIH/NIMH) [E] wrote:
> >
> > I am glad you liked my approach, but I would have preferred it if my
> > code had just been reused... it was unnecessary to reinvent the wheel.
>
> Could you please point me to your code for redirecting System.out and
> System.err? It is not too late to switch.

You can find it here:

http://fiji.sc/cgi-bin/gitweb.cgi?p=fiji.git;a=blob;f=src-plugins/Fiji_Plugins/src/main/java/fiji/util/RedirectErrAndOut.java;h=f3583afdf50183f8351efb87a4583d084b7a0299;hb=refs/heads/master

It does require a class from ij-core:

http://fiji.sc/cgi-bin/gitweb.cgi?p=imagej2/.git;a=blob;f=core/core/src/main/java/imagej/util/LineOutputStream.java;h=9ad0cc2df522504a5455a4d14daf1bb348ce9c56;hb=refs/heads/master

While the first is licensed under GPL (by virtue of being part of the
Fiji_Plugins bundle) and the latter under BSD (2-clause, by virtue of
being part of ImageJ2), both classes were authored by Curtis Rueden
(Cc:ed) and yours truly. I am almost certain that Curtis is okay with
releasing both into the public domain, as required by ImageJ 1.x. I only
humbly request that both be moved into the "ij.*" package structure *1*.

Ciao,
Johannes

Footnote *1*: There is one hack I made to prevent multiple
re-redirections, where RedirectErrAndOut#isRedirected(PrintStream) asks
for the class name of the existing redirection and checks for the prefix
"fiji.". I would really like it if it could ask for both "ij." and "fiji."
and will change it in Fiji's source code right away.

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