You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by jaki <ja...@infosys.com> on 2008/09/17 11:51:00 UTC

outputproperty problem?

Isn't outputproperty attribute of <java> task supposed to capture values
printed by System.out.println? I have a program with a System.out.println in
it and when I run this using <java> in ant, I can see the printed value on
the console but outproperty is echoed as blank? Why must this be happening?
Should I set something to activate outputproperty?
-- 
View this message in context: http://www.nabble.com/%3Cjava%3E-outputproperty-problem--tp19528043p19528043.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: AW: outputproperty problem?

Posted by Ja...@rzf.fin-nrw.de.
Do you execute only these two files (build.xml and Program.java)?
With that behaviour I would think that the properties are set to emtpy strings for <java>.

Jan 

-----Ursprüngliche Nachricht-----
Von: jaki [mailto:jackie_james@infosys.com] 
Gesendet: Mittwoch, 17. September 2008 13:07
An: user@ant.apache.org
Betreff: Re: AW: <java> outputproperty problem?


No, the problem still persists :(

This is the output I get on the console:

Hello System.out
     [echo] Output: ''
     [echo] Error : ''



Jan.Materne wrote:
> 
> This works for me
> - messages are in the properties
> - no output from the class on the console (just from ant)
> 
> 
> Jan
> 
> 
> <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");
>     }
> }
> 
> Buildfile: build.xml
>      [echo] Output: 'Hello System.out'
>      [echo] Error : 'Hello System.err'
> 
> BUILD SUCCESSFUL
> 
> -----Ursprüngliche Nachricht-----
> Von: jaki [mailto:jackie_james@infosys.com] 
> Gesendet: Mittwoch, 17. September 2008 11:51
> An: user@ant.apache.org
> Betreff: <java> outputproperty problem?
> 
> 
> Isn't outputproperty attribute of <java> task supposed to capture values
> printed by System.out.println? I have a program with a System.out.println
> in
> it and when I run this using <java> in ant, I can see the printed value on
> the console but outproperty is echoed as blank? Why must this be
> happening?
> Should I set something to activate outputproperty?
> -- 
> View this message in context:
> http://www.nabble.com/%3Cjava%3E-outputproperty-problem--tp19528043p19528043.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%3Cjava%3E-outputproperty-problem--tp19528043p19529641.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: AW: outputproperty problem?

Posted by "sankar.gorthi" <sg...@thinkpassenger.com>.
Hi jaki,

In case you're still facing the same problem, I was able to resolve this by
forking the java execution in the ant script. Adding the fork="true" option
to the java execution task in ant set the property correctly.

FYI, I was executing the ant task from a maven-antrun-plugin.

Hope that helps,

Sankar.



jaki wrote:
> 
> No, the problem still persists :(
> 
> This is the output I get on the console:
> 
> Hello System.out
>      [echo] Output: ''
>      [echo] Error : ''
> 
> 
> 
> Jan.Materne wrote:
>> 
>> This works for me
>> - messages are in the properties
>> - no output from the class on the console (just from ant)
>> 
>> 
>> Jan
>> 
>> 
>> <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");
>>     }
>> }
>> 
>> Buildfile: build.xml
>>      [echo] Output: 'Hello System.out'
>>      [echo] Error : 'Hello System.err'
>> 
>> BUILD SUCCESSFUL
>> 
>> -----Ursprüngliche Nachricht-----
>> Von: jaki [mailto:jackie_james@infosys.com] 
>> Gesendet: Mittwoch, 17. September 2008 11:51
>> An: user@ant.apache.org
>> Betreff: <java> outputproperty problem?
>> 
>> 
>> Isn't outputproperty attribute of <java> task supposed to capture values
>> printed by System.out.println? I have a program with a System.out.println
>> in
>> it and when I run this using <java> in ant, I can see the printed value
>> on
>> the console but outproperty is echoed as blank? Why must this be
>> happening?
>> Should I set something to activate outputproperty?
>> -- 
>> View this message in context:
>> http://www.nabble.com/%3Cjava%3E-outputproperty-problem--tp19528043p19528043.html
>> Sent from the Ant - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%3Cjava%3E-outputproperty-problem--tp19528043p21155866.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: AW: outputproperty problem?

Posted by jaki <ja...@infosys.com>.
No, the problem still persists :(

This is the output I get on the console:

Hello System.out
     [echo] Output: ''
     [echo] Error : ''



Jan.Materne wrote:
> 
> This works for me
> - messages are in the properties
> - no output from the class on the console (just from ant)
> 
> 
> Jan
> 
> 
> <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");
>     }
> }
> 
> Buildfile: build.xml
>      [echo] Output: 'Hello System.out'
>      [echo] Error : 'Hello System.err'
> 
> BUILD SUCCESSFUL
> 
> -----Ursprüngliche Nachricht-----
> Von: jaki [mailto:jackie_james@infosys.com] 
> Gesendet: Mittwoch, 17. September 2008 11:51
> An: user@ant.apache.org
> Betreff: <java> outputproperty problem?
> 
> 
> Isn't outputproperty attribute of <java> task supposed to capture values
> printed by System.out.println? I have a program with a System.out.println
> in
> it and when I run this using <java> in ant, I can see the printed value on
> the console but outproperty is echoed as blank? Why must this be
> happening?
> Should I set something to activate outputproperty?
> -- 
> View this message in context:
> http://www.nabble.com/%3Cjava%3E-outputproperty-problem--tp19528043p19528043.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%3Cjava%3E-outputproperty-problem--tp19528043p19529641.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: outputproperty problem?

Posted by Ja...@rzf.fin-nrw.de.
This works for me
- messages are in the properties
- no output from the class on the console (just from ant)


Jan


<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");
    }
}

Buildfile: build.xml
     [echo] Output: 'Hello System.out'
     [echo] Error : 'Hello System.err'

BUILD SUCCESSFUL

-----Ursprüngliche Nachricht-----
Von: jaki [mailto:jackie_james@infosys.com] 
Gesendet: Mittwoch, 17. September 2008 11:51
An: user@ant.apache.org
Betreff: <java> outputproperty problem?


Isn't outputproperty attribute of <java> task supposed to capture values
printed by System.out.println? I have a program with a System.out.println in
it and when I run this using <java> in ant, I can see the printed value on
the console but outproperty is echoed as blank? Why must this be happening?
Should I set something to activate outputproperty?
-- 
View this message in context: http://www.nabble.com/%3Cjava%3E-outputproperty-problem--tp19528043p19528043.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org