How do I catch the stack trace from jvm.dll?

I have a C ++ console application that uses a third party dll (jvm.dll, indirectly) that uses printf to print various error messages (Java stacktrace). I need to catch these stacks into a string in order to process them further, or at least see them on the console.

The thing is, I only see the stacktrace when debugging my application in VisualStudio (VS 2010). When I run my application "normally", that is, from the command line, nothing is printed to the console. Therefore VS is able to interfere with the java output in some way and display it. I need to be able to do the same.

I've already tried freopen () but with no success. Also, I found this question for the same problem, but without a clear answer.


source to share

All Articles