Eclipse 中 使用外部jar 来调试java application

1. write a java application

2. export it as jar file, make sure java -jar filename can run without problem

作为调试服务器
1. in the path of jar file, run following comand

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address="8000" -jar Test_fat.jar

2. in eclipse , project, right click debug --> debug configurations

--> remote java application

connection type: sock attach, other item can use default value, at last , click debug

作为调试客户机

1. in eclipse , project, right click debug --> debug configurations

--> remote java application

connection type: sock listen, other item can use default value, at last , click debug

2. 1. in the path of jar file, run following comand

java -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:8000,suspend=y -jar Test_fat.jar

你可能感兴趣的:(java,eclipse,socket)