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 DMK. You must first call the Java compiler on the source code to obtain its .class file before using the proxygen compiler to generate the managed object. Finally, you must compile the Java code generated by the proxygen compiler.
The source code for the Simple class is contained in the installDir/SUNWjdmk/jdmk5.0/examples/MonitorMBean directory, where installDir is the directory under which the Java DMK was installed.
On the Solaris platform, the installDir file hierarchy is not writable by default. In this case you must copy the Simple.java and SimpleMBean.java files to a directory where you have write permissions.
Set your CLASSPATH as follows:
In the Solaris operating environment:
prompt% installDir/SUNWjdmk/jdmk5.0/lib/jdmkrt.jar and jdmktk.jar |
In a Windows 2000 operating environment:
installDir\SUNWjdmk\jdmk5.0\1.2\lib\jdmkrt.jar and jdmktk.jar |
Type the following commands:
prompt% javac Simple.java SimpleMBean.java prompt% /.../bin/proxygen/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 |
Proxy MBeans generated using proxygen in Java DMK 4.2 must be regenerated to run in Java DMK 5.0, because some of the methods used in version 4.2 have been deprecated.