开发者

Remote debugging using Eclipse - How to set breakpoints?

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, th开发者_StackOverflowe remote app is connected and in the debug mode, now how do I put a breakpoint in the file where I want)

Remote debugging using Eclipse - How to set breakpoints?


Add the line below:

-agentlib:jdwp=transport=dt_socket,address=1044,server=y,suspend=n

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜