# Why "java -version" command output was placed in stderr and not in stdout using win\_command.

**URL:** <https://forum.ansible.com/t/why-java-version-command-output-was-placed-in-stderr-and-not-in-stdout-using-win-command/30501>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 6, 2019, 8:30am UTC](https://forum.ansible.com/t/why-java-version-command-output-was-placed-in-stderr-and-not-in-stdout-using-win-command/30501 "2019-06-06T08:30:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cindy](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@Cindy](https://forum.ansible.com/u/Cindy)\
**Post date:** [June 6, 2019, 8:30am UTC](https://forum.ansible.com/t/why-java-version-command-output-was-placed-in-stderr-and-not-in-stdout-using-win-command/30501/1 "2019-06-06T08:30:33Z")

</div>

Hi, I was new on Ansible and testing some functionalities with Windows hosts.

Task:

- name: Check if Java is installed  
win\_command: java -version  
register: java\_result

- name: Print Java\_result  
debug:  
msg: “{{ java\_result }}”

Output:

 ![](https://us1.discourse-cdn.com/ansible/original/2X/3/3a55d0c28659323b70766a80562fe8e0736d526a.png)

Hi, I was wondering why my output was placed in stderr.  
I was expecting the output will be in stdout since the command was successful and there was installed java in my host.

Can someone give me their opinion on this?  
Thank you very much.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [June 6, 2019, 8:50am UTC](https://forum.ansible.com/t/why-java-version-command-output-was-placed-in-stderr-and-not-in-stdout-using-win-command/30501/2 "2019-06-06T08:50:36Z")

</div>

That’s just what java does [https://stackoverflow.com/questions/13483443/why-does-java-version-go-to-stderr](https://stackoverflow.com/questions/13483443/why-does-java-version-go-to-stderr). Having values in stderr does not mean there was a failure, just that the program sent data to that stream.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Cindy](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@Cindy](https://forum.ansible.com/u/Cindy)\
**Post date:** [June 6, 2019, 9:26am UTC](https://forum.ansible.com/t/why-java-version-command-output-was-placed-in-stderr-and-not-in-stdout-using-win-command/30501/3 "2019-06-06T09:26:28Z")

</div>

thank you very much for the input Jordan. 🙂  
I will try different workaround to catch this.
