简体   繁体   中英

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

替代文字

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM