Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command Line Output to a TXT file (Java.exe -version) Returning blank

I need to output some information regarding the java.exe verison to a text file. The command prompt command

C:\Windows\System32\Java.exe > C:\Users|txt.txt outputs everything to the correct file.

When I try to add the -version

C:\Windows\System32\Java.exe -version > C:\Users|txt.txt, the output text file remains blank.

Is there a way to get this into a txt file?

like image 472
sealz Avatar asked Nov 28 '22 14:11

sealz


1 Answers

Use this command line instead:

C:\Windows\System32\Java.exe -version 2> C:\Users\txt.txt

(note the additional 2.)

Java is writing the version information to standard error (channel 2) rather than standard output.

like image 105
RichieHindle Avatar answered Feb 16 '23 02:02

RichieHindle