如何在Eclipse中使用Ant脚本时,调试Java code [英] How to debug Java code when using ANT script in Eclipse

查看:223
本文介绍了如何在Eclipse中使用Ant脚本时,调试Java code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个java类,我需要调试它(把断点,并继续使用F6)。我使用Ant脚本来初始化,构建,部署和运行code。我使用的:

I have a java class and I need to debug it (put breakpoints and continue using F6). I am using ANT script to init, build, deploy and run the code. I am using:

<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" debuglevel="lines,vars,source">

..........

</javac>

但是,当我把断点在我foo.java类线和我运行Ant脚本(运行部分,右键单击运行 - >调试方式 - > Ant构建),Eclipse不停止在该行code的。

But when I place the breakpoint in a line in my foo.java class and I run the ant script (the run part, Right Click on run-->Debug As-->Ant Build), Eclipse does not stop at that line of code.

我是什么错过了?!

推荐答案

&LT; java的&GT; Ant任务,你应该增加两个JVM参数(&LT; jvmarg&GT; IIRC)来启动调试:

In the <java> ant task you should add two jvm parameters (<jvmarg> IIRC) to turn on debugging:

 -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5432

这将启动Java程序调试打开,程序将准备接受在端口5432连接调试那么你应该使用IDE的远程调试工具,将它连接到端口5432。

This will launch the java program with debugging turned on and the program will be ready to accept debugger connections on port 5432. Then you should use your IDE's remote debugging facility and direct it to connect to port 5432.

这篇关于如何在Eclipse中使用Ant脚本时,调试Java code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆