Java Dynamic Management Kit 5.1 Tutorial

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 

Solaris / Linux / Windows 2000 


Within the examples directory, the examples themselves are separated into two sub-directories: legacy and current. This is to make a clear distinction between the examples that demonstrate the older implementations of features that have been superseded by the implementation of JMX Remote API in Java DMK 5.1. The implementations of features that have been deprecated in Java DMK 5.1 are now held in the legacy directory. The examples of the current features are held in current.

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 directory in which you compile and run the examples.

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 Platform, Standard Edition (J2SE). In addition, your classpath must also contain the Java archive (JAR) files for the Java DMK runtime libraries, as well as the current directory (.). If you are using J2SE 1.4.x, then you must also include the runtime libraries for JMX and JMX Remote API, as well as other JAR files relating to the Simple Authentication Security layer (SASL) and Secure Sockets Layer (SSL) security mechanisms, should you require them.

At the time of writing, a Beta release of version 1.5.0 of the J2SE platform is available. The JMX API and the mandatory part of JMX Remote API have been included in J2SE 1.5, so if you are using version 1.5.0 of the J2SE platform, you do not need to add the jmx.jar, jmxremote.jar and SASL libraries to your class path.

For a Solaris or RedHat Linux platform, use the classpath given in Table P–1. For a Windows 2000 platform, use the classpath given in Table P–2.

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

J2SE Platform Version 




1.5.0 (Beta) 


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

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

J2SE Platform Version 




1.5.0 (Beta) 


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 J2SE platform 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 mibgen tool and the deprecated proxygen tool provided with 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 

Solaris / Linux / Windows 2000