Often is useful to run jconsole on a remote (production) machine. One basically has 2 options to do so. First, you can pierce your firewall and let your application listen to the appropriate JMX and RMI ports. This however always tricky (in particular the RMI). In addition, creating the connection string that jconsole accepts is not nice at all.
The other option, is to do X forwarding. I'll describe here how to do this on MacOS X, with jconsole on any Unix server with, ssh-server, no root password and sudo installed.
- Start X11 (you'll need to install it from the installation CDs).
- Start iterm2.
- Login to the target system with
ssh -X remote_user@system
- Switch to root with
- Get X authorities with
xauth merge ~remote_user/.Xauthority