0

I need to write a program where I can track the way how methods are called. So , i'm trying to use invokestatic, invokevirtual , invokeinterface , invokespecial to track the method calls and follow up.

To do that , I have to input the result of (javap -c sample) [sample is the class] to the program.

So my question is that , is it possible rather than inputting the resultant file of (javap -c sample) , just to input the class name as sample , then the program can create a file executing javap inside the program and output the result to a particular file , and the rest of the program can be executed as usual.?

Huzaim
  • 115
  • 4
  • 13
  • somewhat duplicate of http://stackoverflow.com/q/5604698/995891. Execute extenal program, read it's output via the inputstream and if you think the sampledata should go into a file save it there. – zapl Oct 31 '14 at 04:38
  • see [this SO question](http://stackoverflow.com/questions/14434320/javap-in-a-programmable-way) about javap API (spoiler: it has no API, but there are other tools). – Stanislav Lukyanov Oct 31 '14 at 12:08

0 Answers0