开发者

Attach to another JVM and listen for events? Possible?

I am trying to write a small internal tool to use for debugging focus problems in Swing applications. Right now the debugger tool is built in to the app and enabled via a debug command-line argument.

What I'd love to do is have a separate, standalone Java application that can connect to another JVM and listen for certain events (in this case, PropertyChangeEvents on the KeyboardFocusManager).

Ideally, it should be able to do this without any changes to the application being debugged, so it can be used "on-demand" to debug focus issues in any Swing app. Sort of like how VisualVM can开发者_运维技巧 attach to any running VM.

Is this possible? What are some starting points? JMX? Some other IPC mechanism?


You can use the java platform debugger architecture (JPDA)

http://download.oracle.com/javase/6/docs/technotes/guides/jpda/examples.html


Not sure if this covers it, but.. Assuming the application is started with these flags:

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

You can attach the debugger to the process remotely using Eclipse.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜