其他分享
首页 > 其他分享> > jar调试

jar调试

作者:互联网

在IDEA内新建项目,在项目中新建一个lib目录将jar包放到此处,右键lib文件点击Add as Library添加依赖。
![image.png](https://www.icode9.com/i/ll/?i=img_convert/b2cad4b4f959ba0ed353d094c1d46a7b.png#clientId=u58c1fc97-14ba-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=430&id=uc8a937b5&margin=[object Object]&name=image.png&originHeight=859&originWidth=586&originalType=binary&ratio=1&rotation=0&showTitle=false&size=155221&status=done&style=none&taskId=ue09f938a-ff8f-4ff0-9f32-d73daec03cf&title=&width=293)
添加运行时的启动参数
![image.png](https://www.icode9.com/i/ll/?i=img_convert/9f8316b179ce229838c232a2d6a4a5c4.png#clientId=u58c1fc97-14ba-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=187&id=u6ebd6c9b&margin=[object Object]&name=image.png&originHeight=374&originWidth=549&originalType=binary&ratio=1&rotation=0&showTitle=false&size=28188&status=done&style=none&taskId=uad4e0f05-c7d2-449e-b493-cbba9317654&title=&width=274.5)
![image.png](https://www.icode9.com/i/ll/?i=img_convert/0fe8a65f6865bc5ff01988ac786f44d5.png#clientId=u58c1fc97-14ba-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=322&id=u1b32d4db&margin=[object Object]&name=image.png&originHeight=643&originWidth=1215&originalType=binary&ratio=1&rotation=0&showTitle=false&size=218534&status=done&style=none&taskId=uaf0272a9-6329-4749-a83f-e93583b8b11&title=&width=607.5)
这里为jar包的启动参数,随后点击Apply
![image.png](https://www.icode9.com/i/ll/?i=img_convert/58971c650dcc8978f1b2a1e3527e35b8.png#clientId=u58c1fc97-14ba-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=268&id=ud315551f&margin=[object Object]&name=image.png&originHeight=535&originWidth=1260&originalType=binary&ratio=1&rotation=0&showTitle=false&size=48892&status=done&style=none&taskId=u0ddf6e00-4105-4d84-b30e-80fa07c7093&title=&width=630)
在jar的main处设置断点,随后在lib目录下打开cmd,输入“Java -jar -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005”其中的suspend表示是否赞同顶戴调试器的连接,y为暂停,n为不暂停。建议选择暂停。
![image.png](https://www.icode9.com/i/ll/?i=img_convert/cc12a2696e5db1d85d8993cd787ba346.png#clientId=u2696019c-2e4c-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=257&id=u3b03ad9f&margin=[object Object]&name=image.png&originHeight=514&originWidth=1349&originalType=binary&ratio=1&rotation=0&showTitle=false&size=100380&status=done&style=none&taskId=u1d8c885a-f977-4947-9eb6-7d47d71d1fe&title=&width=674.5)
jar成功停止,调试成功

标签:ratio,img,image,jar,crop,png,调试
来源: https://blog.csdn.net/Munch_D_Rudy/article/details/122457368