This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
When running a ant task from netbeans (using right click on an ant file and selecting run target), it seems that you can't use the outputproperty of the java ant task. The output of System.out.print... is displayed in the console and the outputproperty is empty. Running the same ant file from the command line work as expected. ==== Example === <project> <javac srcdir="." destdir="."/> <java outputproperty="out" errorproperty="err" classname="Program" classpath="."/> <echo>Output: '${out}'</echo> <echo>Error : '${err}'</echo> </project> public class Program { public static void main(String[] args) { System.out.println("Hello System.out"); System.err.println("Hello System.err"); } }
Yes, has to do with special Output Window console handling for <java> programs. Similar to issue #121512. Should be fixed in core-main #019b073dabbc. If you can verify (FIXED -> VERIFIED) in a development build (you will see a notation added to this issue when the fix appears in one), this could be a candidate for a 6.7 patch release.
Integrated into 'main-golden', will be available in build *200907070200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/019b073dabbc User: Jesse Glick <jglick@netbeans.org> Log: #168153: disable I/O tricks if <java> task requests special handling of output/error streams.
The fix replaces NbRedirector even if only e.g. errorproperty is used. Maybe the attached fix would be better.
Created attachment 86637 [details] proposed fix
That would break scripts using the input or inputstring attrs, I think (regressing issue #121512).
...and in general I am guessing that if you are setting up redirections you do not need special Output Window integration. Most usages would be the equivalent to Bourne shell `backticks` with the program doing line-oriented I/O.
For issue #121512 there could be similar 'delegateInputStream' flag which would disable delegation/switch to super call. I still think it is better to adjust NbRedirector behavior than replace it completely (and potentially lose some Redirector setting done before replacement).
I would rather simply discard NbRedirector if there is any special I/O redirection being done, to behave as much as possible like regular CLI Ant. I don't know exactly what you mean by "some settings done before replacement"; the first time any of these methods is called, NbRedirector is thrown out and the standard impl is used. Of course if you have a test case which behaves incorrectly it should be filed as its own bug for inspection.
*** Issue 172107 has been marked as a duplicate of this issue. ***