In order to enable (remote) debugging of JConsole execute JConsole with these options:
jconsole -pluginpath
The kicker is specifying each JVM option as a separate -J options. I have an Eclipse external tool configured to start the console with these options, but you can run from the command line as well. The suspend=y option tells the JVM to suspend JConsole startup until a remote debugger connects. After executing the command you'll see something like:
Listening for transport dt_socket at address: 8000
The JConsole window won't actually display until you've connected with the Eclipse remote debugger. To do that, highlight your plugin project and select Run -> Debug Configurations... from the Eclipse menu. Select "Remote Java Application" in the left pane, right click and choose "New". Make sure your project is specified in the connect tab and keep the defaults for connection type and connection properties. If port 8000 is in use on your machine you'll need to specify a different port for the jConsole Java args and as the Eclipse remote connection port. Next, click Debug. The JConsole window should pop up and the debugger should halt on any breakpoints you've set in your plugin code. Happy debugging!
No comments:
Post a Comment