Thomas said:
I'm also not sure about whether or not availability of System.out is guaranteed
in any way, but I'm sure that it worked for me at least once. At least you can
be sure that it does not throw an exception since it is a PrintStream
The docs of addShutdownHook say:
"Uncaught exceptions are handled in shutdown hooks just as in any other thread,
by invoking the uncaughtException method of the thread's ThreadGroup object. The
default implementation of this method prints the exception's stack trace to
System.err and terminates the thread; it does not cause the virtual machine to
exit or halt."
So they also assume that System.err is available.
Cheers,
Simon