JDI tutorial (trace example)

           Components                          Debugger Interfaces

                /    |--------------|
               /     |     VM       |
 debuggee ----(      |--------------|  <------- JVM TI - Java VM Tool Interface
                    |   back-end   |
                    |--------------|
                /           |
 comm channel -(            |  <--------------- JDWP - Java Debug Wire Protocol
                           |
                     |--------------|
                     | front-end    |
                     |--------------|  <------- JDI - Java Debug Interface
                     |      UI      |
                     |--------------|

JDI是JPDA的上层接口,我们先搭建它的一个example,先感受一下它的功能。

JDI specification 是JDI的类库,JDI 的三个例子 (我们这里运行第一个Trace的例子)

注意:

  1. 需要包含tools.jar包
  2. 使用Eclipse IDE时,需要设置Working directory 指定被运行的类。JDI tutorial (trace example)