Java Dynamic Management Kit 5.0 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 

installDir/SUNWjdmk/jdmk5.0/examples

Windows 2000 

installDir\SUNWjdmk\jdmk5.0\examples

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 

Classpath 

Java2 SDK (JDK 1.4) 

.:installDir/SUNWjdmk/jdmk5.0/lib/jdmkrt.jar:
/usr/sadm/lib/snmp/jsnmpapi.jar

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 

Classpath 

Java2 SDK (JDK 1.4) 

.;installDir\SUNWjdmk\jdmk5.0\lib\jdmkrt.jar;
installDir\SUNWjdmk\jdmk5.0\lib\jsnmpapi.jar

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 

Solaris 

installDir/SUNWjdmk/jdmk5.0/bin

Windows 2000 

installDir\SUNWjdmk\jdmk5.0\bin