For an answer, I suggest you use ^A^C
to select all and copy, and ^V
to paste into your favour editor. (Thank you @SubOptimal) If you use IntelliJ, it can analyse the stack trace and let you navigate it.
From the command line you can do
jstack {pid} > file
to write directly to a file.