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 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.

  The supported arguments of jpcontroller are described below:
  Usage: jpcontroller [host:port] | [pid]

  * if no argument is given, jpcontroller attempts to discover local JVMs that
     are being profiled
  * if a single number is specified, jpcontroller attempts to connect to the JVM
     with process ID [pid]. If that JVM is not profiled, jpcontroller cannot
     connect. In that case, use the jpenable utility first.
  * otherwise, jpcontroller connects to "host:port", where port is the value
     that has been specified in the VM parameter -Djprofiler.jmxServerPort=[port]
     for the profiled JVM.