This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I was wondering if there is a way to save the output displayed on the Java console to a file? Unfortunately for the situation I'm testing updating the code is not an option so it would have to be a setting or something I can change.
A web search only ever seems to reveal code changes to make
The Java console meaning JConsole, or meaning the OS console window (CMD.EXE) ? If it's the latter, the answer varies by OS, of course, but generally there's a way of cutting and pasting out of that window and into a file. For example, in Windows, if you enable "Smart Edit" in the Properties tab for your consoles, then you can rightclick-drag across text to select it. Furthermore, the same Properties wizard lets you set the scrollback of the window so that lines that scroll off the screen don't disappear.
If you mean JConsole, screenshots are about the best you can do, I think.
Use > in the console to redirect the standard output, use 2> to redirect the standard error output:
To merge the standard output and error output redirect the error output to the standard output (it must be put after the standard output redirection or it will redirect to the old standard output - the console):
The console I mean is the one which is shown when you web-start an application (picture attached). Unfortunately a screenshot isn't possible in this case because I'm trying to get some logging from my application at the moment of shutdown (when unfortunately the Java console dissapears also).