Command Line Controller

## Command Line Controller |

| For offline profiling, JProfiler also offers the possibility to attach to the profiled JVM with a command line application in order to interactively start and stop recording and save snapshots. All operations that are supported by the JProfiler MBean, are also supported by this command line tool. Since MBean technology is used, this command line application does not work with 1.4 JVMs.

| When you start the `jpcontroller` executable without arguments, it attempts to connect to a profiled JVM on the local machine. If multiple profiled JVMs were discovered, you can select one from a list. Since the discovery mechanism uses the attach API of the Sun/Oracle JVM, this only works for Sun/Oracle JVMs 1.6 and above. For 1.5 JVMs and other JVM vendors, you have to pass the VM parameter `-Djprofiler.jmxServerPort=[port]` to the profiled JVM. An MBean server will be published on that port and you can specify the chosen port as an argument to `jpcontroller`. With the additional VM parameter `-Djprofiler.jmxPasswordFile=[file]` you can specify a properties file with key value pairs of the form `user=password` to set up authentication. Note that these VM parameters are overridden by the default `com.sun.management.jmxremote.port` VM parameter. With the explicit setup of the JMX server, you can use the command line controller to connect to a remote server. Invoking `jpcontroller host:port` will try to make a connection to the remote host `host`. If the remote computer is only reachable via an IP address, please add `-Djava.rmi.server.hostname=[IP address]` as a VM parameter to the remote VM, otherwise the connection cannot be established.