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?