Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing Java prog output in DOS window 1

Status
Not open for further replies.

DigitalOx

Programmer
Sep 29, 1998
41
0
0
US
Hello all,<br>
I know this isn't directly related to topic but I desperately need help. I am running a Java program in a DOS window and the error messages I am getting are long. So long, that I can only see the end and unfortunately I cannot just scroll up in a DOS window. Does anyone know how I might capture the output of a DOS window? I have tried several programming editors that are supposed to, but can't get em' to work right.<br>
<br>
Anything pertaining to capturing a DOS windows output would be nice.<br>
<br>
Thanks<br>
Scott
 
Hi!<br>
<br>
Try this code. It will redirect the errors to the stderr.log file.<br>
<br>
import java.io.*;<br>
<br>
public class ErrorRedirect {<br>
public static void main(String[] args) throws FileNotFoundException {<br>
FileOutputStream err=new FileOutputStream("stderr.log");<br>
PrintStream errPrintStream=new PrintStream(err);<br>
System.setErr(errPrintStream);<br>
<br>
System.out.println(" "+0/0); // make a stupid error :)))<br>
}<br>
}<br>
<br>
Ps: I am in Budapest (Europe, Hungary), and the local time is GMT+01;<br>
<br>
Bye, Otto.<br>

 
Otto,<br>
<br>
Thanks much! That will help out a lot. I was able to set up the DOS window to display 50 lines, which makes your output really small and hard to read but you see a lot more of it.<br>
<br>
DigitalOx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top