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.

Bug 244873 - STDOUT is duplicated after running an ant java task.
Summary: STDOUT is duplicated after running an ant java task.
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Ant Project (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-03 21:02 UTC by djpeaco
Modified: 2016-07-07 08:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Example project that demonstrates the problem. (31.33 KB, application/zip)
2014-06-03 21:02 UTC, djpeaco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description djpeaco 2014-06-03 21:02:28 UTC
Created attachment 147557 [details]
Example project that demonstrates the problem.

In my project I need to perform some preprocessing of the compiled output, so I added a task in build.xml to perform it, like so.

    <target name="-post-compile">
        <java jar="PreprocessingUtility.jar" output="preprocessing.txt" />
    </target>

This runs fine, and does what I want it to, however every line of STDOUT that occurs after this is displayed twice. In particluar, if I run/debug my application in Netbeans each line of the application's output is duplicated. This can make it more difficult to follow what is going on in the the application.

I have attached a pair of simple projects that demonstrate the problem. Both the preprocessing utility and the main application do nothing but print a single line. The preprocessing utility was built, and it's jar copied to the main application directory, where Ant is looking for it. Then when running the main application in Netbeans I get the following output:

    ant -f C:\\Users\\djpeaco\\Documents\\TAVS\\MainApplication -Dnb.internal.action.name=run run
    init:
    Deleting: C:\Users\djpeaco\Documents\TAVS\MainApplication\build\built-jar.properties
    deps-jar:
    Updating property file: C:\Users\djpeaco\Documents\TAVS\MainApplication\build\built-jar.properties
    compile:
    run:
    Hello from the main application
    Hello from the main application
    BUILD SUCCESSFUL (total time: 1 second)

When using ant to running the same task from the commandline, the problem doesn't occur:
    Unable to locate tools.jar. Expected to find it in C:\Program Files (x86)\Java\jre8\lib\tools.jar
    Buildfile: C:\Users\djpeaco\Documents\MainApplication\build.xml
...
    init:

    -deps-jar-init:
       [delete] Deleting: C:\Users\djpeaco\Documents\TAVS\MainApplication\build\built-jar.properties

    deps-jar:

    -warn-already-built-jar:
    [propertyfile] Updating property file: C:\Users\djpeaco\Documents\TAVS\MainApplication\build\built-jar.properties
...
    -compile-depend:

    -do-compile:

    -post-compile:

    compile:

    run:
         [java] Hello from the main application

    BUILD SUCCESSFUL
    Total time: 2 seconds

I've tried setting fork="true" on the java task, as well as trying several other options, but they don't have any effect. However, if I eliminate the output redirection of the java task the problem goes away. As a work around I can have my preprocessing utility write to a file instead of STDOUT.
Comment 1 Martin Balin 2016-07-07 08:38:40 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss