This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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.
 
GeeCON Prague 2014
 
subject: To where is standard output being written?