Java & Command Prompt Project

Mr. Berzekvii
The dos "type" command shows the contents of specified file on screen. There is no rename in my example.
 
The line:
"C:\Program Files\Java\jdk1.7.0_25\bin\java" > "JVM.txt" as written, will run an executable named java in the folder "C:\Program Files\Java\jdk1.7.0_25\bin\" and direct the output of that executable to a file called JVM.txt in the current folder.

If you just run the java executable by itself, it prints its usage and parameter options to the screen and exits. I suspect the OP is attempting to capture that info in a text file. The problem is that the java executable is not sending its output to STDOUT so the DOS command processor can't "see it" and direct it to a file. It's sending its output to STDERR instead.

The OP needs to read up on DOS command redirection but in order for the OP to accomplish what he is trying to do he needs to change that line to:
"C:\Program Files\Java\jdk1.7.0_25\bin\java" > "JVM.txt" 2<&1 which tells DOS to send both STDOUT and STDERR to the file JVM.txt.
 
Last edited:
The line:
"C:\Program Files\Java\jdk1.7.0_25\bin\java" > "JVM.txt" as written, will run an executable named java in the folder "C:\Program Files\Java\jdk1.7.0_25\bin\" and direct the output of that executable to a file called JVM.txt in the current folder.

If you just run the java executable by itself, it prints its usage and parameter options to the screen and exits. I suspect the OP is attempting to capture that info in a text file. The problem is that the java executable is not sending its output to STDOUT so the DOS command processor can't "see it" and direct it to a file. It's sending its output to STDERR instead.

The OP needs to read up on DOS command redirection but in order for the OP to accomplish what he is trying to do he needs to change that line to:
"C:\Program Files\Java\jdk1.7.0_25\bin\java" > "JVM.txt" 2<&1 which tells DOS to send both STDOUT and STDERR to the file JVM.txt.

Ah I see what you're doing. Still fairly new to the command prompt portion as far as JAVA related tasks are concerned. Thank you.
 
Back
Top Bottom