Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

number of instructions in foo.class java file

I have binary of a java program say foo.class. Is it possible that I count the number of instructions in that class file ? or do I have to have the source code to count the number of instructions.

like image 625
Mian Asbat Ahmad Avatar asked Oct 05 '22 15:10

Mian Asbat Ahmad


1 Answers

Just disassemble the class using javap. The -c option

...prints out disassembled code, i.e., the instructions that comprise the Java bytecodes, for each of the methods in the class. These are documented in the Java Virtual Machine Specification

like image 137
Brian Agnew Avatar answered Oct 10 '22 02:10

Brian Agnew