Class CommandLineJmxClient

java.lang.Object
com.j256.simplejmx.client.CommandLineJmxClient

public class CommandLineJmxClient extends Object
Command-line client that can be used to support interactive or batch-file JMX operations. It can be used with the Main class as a jmx client out of the SimpleJMX jar directly.

See the helpOutput() and exampleOutput() methods for extensive help/usage information.

Author:
graywatson
  • Constructor Details

    • CommandLineJmxClient

      public CommandLineJmxClient(JmxClient jmxClient)
      Create a command line interface on the passed in client.
    • CommandLineJmxClient

      public CommandLineJmxClient(int port) throws JMException
      Create a command line interface connected to the local host at a certain port number.
      Throws:
      JMException
    • CommandLineJmxClient

      public CommandLineJmxClient(String host, int port) throws JMException
      Create a command line interface connected to a host and port combination.
      Throws:
      JMException
    • CommandLineJmxClient

      public CommandLineJmxClient(InetAddress address, int port) throws JMException
      Connect the client to an address and port combination.
      Throws:
      JMException
    • CommandLineJmxClient

      public CommandLineJmxClient(String jmxUrl) throws JMException

      Create a command line interface connected to a JMX server using the full JMX URL format. The URL should look something like:

      service:jmx:rmi:///jndi/rmi://hostName:portNumber/jmxrmi
      
      Throws:
      JMException
  • Method Details

    • runCommands

      public void runCommands(String[] commands) throws IOException
      Run commands from the String array.
      Throws:
      IOException
    • runBatchFile

      public void runBatchFile(File batchFile) throws IOException
      Read in commands from the batch-file and execute them.
      Throws:
      IOException
    • runCommandLine

      public void runCommandLine() throws IOException
      Run the Jmx command line client reading commands from System.in.
      Throws:
      IOException
    • close

      public void close()
      Close the associated Jmx client.