The following example shows how to generate the managed object for the Simple class and SimpleMBean interface, which is provided as an example with the Java Dynamic Management Kit. You must first call the Java compiler on the source code to obtain its .class file before using proxygen to generate the managed object. Finally, you must compile the Java code generated by proxygen.
The source code for the Simpleclass is contained in the installDir/SUNWjdmk/jdmk4.0/JDKversion/examples/MonitorMBean directory, where installDir is the directory under which the Java Dynamic Management Kit was installed.
On the Solaris platform, the installDir file hierarchy is not writable by default. In this case, you will first have to copy the Simple.java and SimpleMBean.java files to a directory where you have write permissions.
Type these commands:
prompt% javac Simple.java SimpleMBean.java prompt% proxygen -classpath . Simple Destination directory set to ./. Starting compilation of Simple. Starting to generate stub SimpleProxy.java for class Simple Starting to generate MBean interface SimpleProxyMBean.java for class Simple |
Before continuing, you need to set your CLASSPATH as follows:
In a Solaris operating environment:
prompt% installDir/SUNWjdmk/jdmk4.0/1.2/lib/jdmkrt.jar |
In a Windows NT operating environment:
installDir\SUNWjdmk\jdmk4.0\1.2\lib\jdmkrt.jar |
In a Solaris operating environment:
installDir/SUNWjdmk/jdmk4.0/1.1/lib/jdmkrt.jar |
/SUNWjdmk/jdmk4.0/1.1/lib/collections.jar |
In a Windows NT operating environment:
installDir\SUNWjdmk\jdmk4.0\1.1\lib\jdmkrt.jar |
\SUNWjdmk\jdmk4.0\1.1\lib\collections.jar |
prompt% javac SimpleProxy.java SimpleProxyMBean.java |