Gets the stack trace as string in Java.