使用 Eclipse 远程调试 - 如何设置断点?
我问了这个关于如何调试服务器端的问题应用程序,我想我正在寻找 Java 远程调试。
我已经配置了服务器端启动脚本:
JAVA_OPTS="-Xmx2G -server -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n"
通过此,我假设远程 java 应用程序应该在 localhost:1044 上可用(首先使用 localhost 尝试)
但是,接下来我该怎么办?我已通过 Run-->Debug Configurations
将调试选项配置为要调试的类。但它要求我单击“调试”。但我的类没有 main() 方法。
比如说,我想在 Methods.java
中调试 getValue()
,现在 getValue()
是从客户端调用的(通过 tcp)。
那么,当调用该方法时,如何将 java 进程附加到 eclipse 远程调试器呢?我是否错过了有关远程调试的基本知识?
更新:(我可以在调试视图中看到这一点,这意味着远程应用程序已连接并处于调试模式,现在如何在我想要的文件中放置断点)
I asked this question about how to debug server side applications and I think I was looking for Java remote Debugging.
I have configured my server side startup script:
JAVA_OPTS="-Xmx2G -server -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n"
By this, I assume the remote java app should be available on localhost:1044 (try it first using localhost)
But, what do I do next? I have configured the debug options to the class to be debugged via Run-->Debug Configurations
. But it asks me to click Debug. But my class does not have a main() method.
Say, I want to debug getValue()
in Methods.java
, now getValue()
is invoked from a client (via tcp).
So, how do I attach the java process to eclipse remote debugger when that method is invoked? Am I missing out on something basic about remote debugging?
UPDATE: (I can see this in my debug view, that means, the remote app is connected and in the debug mode, now how do I put a breakpoint in the file where I want)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加以下行:
以调试模式运行 eclipse
对于 eclipse,单击 debug as icon >调试配置>>添加新的远程 java 应用程序 >将项目更改为您需要的项目并将端口更改为 1044,然后单击“应用并调试”。
设置断点并访问远程应用程序
Add the line below:
to run eclipse in debug mode
For eclipse, click on debug as icon > debug configurations > add a new remote java application > change the project to the project that you need and port to 1044 and click on apply and debug.
Put your breakpoint and access the remote application