Eclipse远程调试jar包

使用 Eclipse 远程调试 Java 应用程序

普通Java程序:

1、导出包括调试信息的jar工程

在eclipse中,选择 Window > Preferences > Java > Compiler 来修改设置。 全选Classfile Generation选项卡内的选项(这里的选项是为了能把Debug需要的信息也写入到class字节码文件[d1])。然后从eclipse导出工程为remoting-debug.jar。

 

2、服务器运行

 

Java代码  

1. java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000 -jar remoting-debug.jar  

 

3、本地调试

     运行后,选择 Run>DebugConfigurations...>Remote Java Application 然后:

    * 在Project选项卡选择需要调试的project。(其实只要选择其中一个你要调试的的project即可)

    * Connection TypeStandard (Socket Listen)

    * Port为address的值8000

 

 

Tomcat应用:

 1、在startup.bat的":end"前增加

 

Shell代码  

1. set JPDA_TRANSPORT=dt_socket  

2. set JPDA_ADDRESS=8000  

3. set JPDA_SUSPEND=y  

4.   

5.   

6. call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%  



 

以上设置的这些参数最终在catalina.bat中被调用!

 

2、参考【java程序】的[步骤3]的操作。 在eclipse里面的设置和上面的java相同。

 

参考:

Eclipse调试常用技巧 http://www.iteye.com/topic/633824

http://www.ibm.com/developerworks/cn/opensource/os-eclipse-javadebug/

http://yiminghe.iteye.com/blog/1027707

http://www.oschina.net/question/54100_10243

 

d1 missing line number attributes的解决

http://www.cnblogs.com/sos-blue/archive/2012/01/05/2313047.html

 

写道

Eclipse下Debug时弹出错误“Unable to install breakpoint due to missing line numberattributes,Modify compiler options togenerate line number attributes" 

遇到这个错误时找到的解答方案汇总: 
1、使用Ant编译时,未打开debug开关,在写javac 任务时确认debug=true,否则不能调试。THe settings for the eclipse compiler don't affect the ant buildand even if you launch the ant build from within eclipse. ant controls it's owncompiler settings.you can tell ant to generate debugging info like this 'javac... debug="true".../>(我的问题是因为这个原因); 
2、编译器的设置问题,window->preferences->java->Compiler在compiler起始页,classfile Generation区域中确认已经勾选了All line number attributes to generated class files。如果已经勾选,从新来一下再Apply一下。或者从项目层次进行设定,项目属性->java compiler同样在起始页,确定已经勾选 
Eclipse报的这个错,无非就这两个原因造成的

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值