File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes To where is standard output being written? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "To where is standard output being written?" Watch "To where is standard output being written?" New topic
Author

To where is standard output being written?

d jones
Ranch Hand

Joined: Mar 13, 2006
Posts: 76
Is it possible to determine where java is writing its standard output?

If we start a program with "java testProgram > logfile.log"

Is it possible to identify in the program that it is writing its standard output to a file called logfile.log?

Many Thanks
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
No, not with Pure Java anyway. The redirection is being done by the operating system, so Java does not know about it.

If it was really, really important to you, it might be possible to find out, using either native code (JNI) or external processes (Runtime.exec()). Neither approach is portable or attractive.

Why do you want this information?


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To where is standard output being written?