title: Trace every instruction in java bytecode using BCEL
body: <p>I am using BCEL for ByteCode generation, I just want to print out (println) before every line in the static methods of the input class. I tried instrumentation using BCEL but it result in different form of errors. It says</p>
  
  <pre><code>Exception in thread "main" java.lang.VerifyError: StackMapTable error: bad offset in method C.max(Ljava/lang/String;II)I
  </code></pre>
  
  <p>Sometimes it start working if I place some static method call on any instruction and sometime it not. Any help would be really appreciated...</p>
  
  <p><strong>Update:</strong> I fixed it. It was not something with the BCEL library, it was JDK version (1.7) which is not verifying my instrumented classes. So if someone encounter such problem either use JDK 1.6 or use the JVM option "-XX:-UseSplitVerifier".</p>
  
  <p>Cheers</p>