java JDB断点运行原理

2020-06-27  本文已影响0人  来安_693d

public class Test {

public static void main(String[] args) throws InterruptedException {

System.out.println("prog start !!!!!!!!!!!!!");

// new Thread(new MyThread()).start();

int sum = 0;

while (true) {

try {

sum ++;

System.out.println("start sleep sum ="+sum);

Thread.sleep(1000);

System.out.println("end sleep");

int a = 1;

int b = 2;

int c = 3;

int d = 0;

d = a + b;

System.out.println("d = " + d);

} catch (InterruptedException e) {

e.printStackTrace();

}

}

}

}

javac Test.java

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -classpath . Test

jdb -connect com.sun.jdi.SocketAttach:hostname=127.0.0.1,port=8000

jdb help

上一篇 下一篇

猜你喜欢

热点阅读