title: How can I get the current stack trace in Java?
body: <p>How do I get the current <a href="http://en.wikipedia.org/wiki/Stack_trace" rel="noreferrer">stack trace</a> in Java, like how in .NET you can do <a href="http://msdn.microsoft.com/en-us/library/system.environment.stacktrace.aspx?ppud=4" rel="noreferrer"><code>Environment.StackTrace</code></a>?</p>
  
  <p>I found <code>Thread.dumpStack()</code> but it is not what I want - I want to get the stack trace back, not print it out.</p>