File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
To where is standard output being written?
Joined: Mar 13, 2006
Sep 05, 2007 08:59:00
Is it possible to determine where
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?
Joined: Oct 30, 2001
Sep 05, 2007 09:11:00
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
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.
It is sorta covered in the
JavaRanch Style Guide
subject: To where is standard output being written?
get Output of a main method call
java code on as a output
Difference b/w System.out.println and err.println
Printing unicode character
Closing the DOS window?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014