无断点测试
我在 Visual Studio 中用 C++ 编写代码已有好几年了。
我现在正在使用 eclipse 进行 java 工作。
java程序是从.bat文件启动的,所以我无法对它们进行断点调试。
如果无法单步执行我的代码,我发现很难找到错误的根本原因,因为引发的异常通常不是问题的根源。
如何在不访问断点的情况下调试代码?
I have coded in c++ in visual studio for several years.
I am now working in java with eclipse.
the java programs are launched from a .bat file so I cannot breakpoint them to debug.
Without being able to step through my code i am finding it very hard to find the root cause of the error as the thrown exception is not usually the source of the problem.
How can I debug my code without access to breakpoints ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以按照 Ben J 的建议找到 main 方法,并从 Eclipse 运行它。要将参数传递给它,请编辑运行配置。例如,右键单击主类,单击“运行方式”,然后单击“运行配置...”。选择“参数”选项卡并输入您需要的任何内容。
或者,由于您需要对此进行调试,请单击“调试为”和“调试配置...”。
You can find the main method, as suggested by Ben J, and run this from Eclipse. To pass arguments to it, edit the run configuration. e.g. Right-click on the main class, click "Run As" and then "Run Configurations...". Select the "Arguments" tab and enter whatever you need.
Or since you need to debug this, click "Debug As" and "Debug Configurations..." instead.
使用 Maven 或 Ant 来启动程序,而不是使用批处理文件。与 Eclipse 的集成要好得多。
Use Maven or Ant to launch your programs, instead of a batch file. There is much better integration with Eclipse.