Java Dynamic Management Kit 5.1 Tutorial

1.3 Running the Standard MBean Example

The examplesDir/StandardMBean directory contains the SimpleStandard.java and SimpleStandardMBean.java files which make up the MBean. This directory also contains a simple agent application which instantiates this MBean, introspects its management interface, and manipulates its attributes and operations.

To Run the Standard MBean Example
  1. Compile all files in this directory with the javac command.

    For example, on the Solaris platform with the Korn shell, type:


    $ cd examplesDir/current/StandardMBean/
    $ javac -classpath classpath *.java
    
  2. To run the example, start the agent class which will interact with the SimpleStandard MBean:


    $ java -classpath classpath StandardAgent
    
  3. Press Enter when the application pauses, to step through the example.

    The agent application handles all input and output in this example and gives a view of the MBean at runtime.

We will examine how agents work in Chapter 2, Dynamic MBeans, but this example demonstrates how the MBean interface limits the view of what the MBean exposes for management. Roughly, the agent introspects the MBean interface at runtime to determine what attributes and operations are available. You then see the result of calling the getters, setters, and operations.

Part II also covers the topics of object names and exceptions which you see when running this example.