Java's .printStackTrace
method is agnostic to the existence of Clojure's *err*
var, so binding
it won't change Java's behavior.
Consider instead
(use 'clojure.stacktrace)
(try (/ 1 0)
(catch Exception e
(with-out-str (print-stack-trace))))
See source of print-stack-trace
for details, but basically it is using the .getStackTrace
method and then printing to *out*
, which you can bind with with-out-str
, for example.