Java Dynamic Management Kit 5.0 Tutorial


The JavaTM Dynamic Management Kit (DMK) provides a set of Java classes and tools for developing management solutions. This product conforms to the Java Management Extensions (JMXTM), v1.1 Maintenance Release, which defines a three-level architecture:

The JMX architecture is applicable to network management, remote system maintenance, application provisioning, and the new management needs of the service-based network.

Once you are familiar with management concepts, the Java Dynamic Management Kit 5.0 Tutorial is intended to demonstrate each of the management levels and how they interact. The parts of this tutorial will show you:

Taken as a whole, these topics will demonstrate the complete development process for implementing a management solution in the Java programming language.

This book ends with a part devoted to the details of programming SNMP managers and agents (peers) using the Java DMK.

Who Should Use This Book

This tutorial is for developers who would like to learn how to instrument new or existing resources for management, write dynamic agents, or write management applications. You should be familiar with Java programming. Some tutorials also rely on system and network management concepts: knowledge of these is helpful, though not required.

This book is not intended to be an exhaustive reference. Management concepts and product features are covered in Getting Started with the Java Dynamic Management Kit 5.0, and the complete JavadocTM API definitions are provided in the online documentation package.

Before You Read This Book

To build and run the sample programs in this tutorial or use the tool commands provided in the Java DMK, you must have a complete installation of the product on your system.

Related Documentation

Before programming with the Java DMK you should be familiar with the concepts and tools used throughout this tutorial. The following books are part of the documentation set:

Book Title 

Part Number 

Getting Started with the Java Dynamic Management Kit 5.0


Java Dynamic Management Kit 5.0 Tools Reference


Java Dynamic Management Kit 5.0 Installation Guide


These books are available online after you have installed the documentation package of the Java DMK. The online documentation also includes the Javadoc API for the Java packages and classes, including those of the Java Management extensions. Using any web browser, open the home page corresponding to your platform. Table P–1 shows the location of the home page for the SolarisTM operating environment and Windows 2000 operating environment.

Table P–1 Accessing Online Documentation

Operating Environment 

Home Page Location 

Solaris environment 


Windows 2000 environment 


In these file names, installDir refers to the base directory of your Java DMK installation. In a default installation procedure, installDir is:

These conventions are used throughout this book whenever referring to files or directories which are part of the installation.

The Java DMK relies on the management architecture of the JMX specification. The specification document, Java Management Extensions Instrumentation and Agent Specification, v1.1 (Maintenance Release, March 2002) is provided in the product documentation package under the file name jmx_instr_agent.pdf.

The structure of this book is based on the The Java Tutorial:

Some chapters in the part on SNMP refer to RFC standards for further information. The complete text of RFC papers can be found on the Internet site of the Internet Engineering Task Force:

Disclaimer – This site is in no way affiliated with Sun Microsystems, Inc. and Sun makes no claim as to the accuracy or relevance of the data it contains.

Directories and Classpath

These tutorials are based on the example programs shipped with the Java DMK. Each example is a set of Java source code files in a separate subdirectory. The following table gives the location of the main examples directory:

Operating Environment 

Examples Directory 



Windows 2000 


Except where noted, the source code in this book is taken from these example programs. However, some code fragments might be rearranged and comments might be changed. Program listings in the tutorials usually simplify comments and omit output statements for space considerations.

On the Solaris platform, you must have root access to write in the installed examples directory. For this reason, it might be necessary to copy all examples to a different location before compiling them. Throughout the rest of this book, we will use the term examplesDir to refer to the main examples directory in a location where you can compile and run them.

When either compiling or running the example programs, make sure that your PATH and CLASSPATH environment variables are correctly set to use the Java 2 SDK. In addition, your classpath must also contain the Java archive (JAR) files for the Java DMK runtime libraries (jdmkrt.jar and jsnmpapi.jar), as well as the current directory (.). For a Solaris platform, use the classpath given in Table P–2. For a Windows 2000 platform, use the classpath given in Table P–3.

Table P–2 Classpath for Compiling or Running the Examples on a Solaris Platform

JDK Version 


Java2 SDK (JDK 1.4) 


If you installed the software in the default directory on a Solaris platform, installDir will be /opt.

Table P–3 Classpath for Compiling or Running the Examples on a Windows 2000 Platform

JDK Version 


Java2 SDK (JDK 1.4) 


If you installed the software in the default directory on a Windows 2000 platform, installDir will be C:\Program Files

These classpaths assume that you are in the subdirectory of a particular example when compiling or running it. Specify the classpath on the command line of the javac and java tools with the -classpath option. The JDK version must match the version of the javac or java command that you are using.

Throughout the rest of this book, we will use the term classpath in command-line examples to indicate that you must use the classpath indicated in this section. You can also define this classpath in an environment variable according to your platform and omit its definition on the command line.

To use the proxygen and mibgen tools provided with the Java DMK, add the installation binary directory to your environment's path. The following table gives the location of this directory:

Operating Environment 

Binary Directories 



Windows 2000 


How This Book Is Organized

This book follows the organization of the The Java Tutorial. Each major part covers a subject and each chapter covers a topic within that subject.

Accessing Sun Documentation

You can view and print a broad selection of SunTM documentation, including localized versions, at:

You can also purchase printed copies of select Sun documentation from iUniverse, the Sun documentation provider, at:

Typographic Conventions

The following table describes the typographic changes used in this book.

Typeface or Symbol 




The names of commands, files, and directories; on-screen computer output 

Edit your .login file.

Use ls -a to list all files.

machine_name% you have mail.


What you type, contrasted with on-screen computer output 

machine-name% su



Command-line placeholder: replace with a real name or value 

To delete a file, type rm filename.


Book titles, new words, or terms, or words to be emphasized. 

Read Chapter 6 in User's Guide.

These are called class options.

You must be root to do this.

In addition, bold typeface is used in some of the code samples to highlight important statements and enhance your understanding.

Shell Prompts in Command Examples

The following table shows the default system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.



C shell prompt 


C shell superuser prompt 


Bourne shell and Korn shell prompt 


Bourne shell and Korn shell superuser prompt