Using the Microsoft Script Debugger with the Microsoft VM Previous
Previous
About Tools
About Tools

Microsoft® ActiveX™ Debugger Support for the Microsoft Win32 Virtual Machine (VM) for Java

Installing the ActiveX Debugger , Understanding ActiveX Debugging Mode , Using SetDebug.exe , Java Source Code , Notes on Using the Debugger

This article explains how to get started using the Microsoft Script Debugger to debug Java code using the Microsoft VM for Java. For information on using the Microsoft Script Debugger in general, see the help that comes with the Microsoft Script Debugger. You can also find more information by visiting the script debugger Web site at http://www.microsoft.com/workshop/prog/scriptie .


Installing the ActiveX Debugger

To use the Microsoft Script Debugger to debug Java applets, you must perform the following steps:

  1. To install the Microsoft Script Debugger, run the self-extracting file in the ScriptDebugger subdirectory of the directory in which you installed the Microsoft SDK for Java.

    This installs the Script Debugger and the files required to enable and disable Java debugging in Microsoft&tg; Internet Explorer and Jview.

  2. Run SetDebug.exe (installed in the Windows directory), and then click Yes in the dialog box that asks if you want to enable ActiveX Debugging for Java. For more information about , see Understanding ActiveX Debugging Mode and Using SetDebug.exe.
  3. Run SetDebug.exe again, using the -p option, to add any paths to the source path, a registry entry that tells the Microsoft VM where to find your source code. See Using SetDebug.exe for more information on this.


Understanding ActiveX Debugging Mode

This ActiveX debugger implementation runs in a special mode of the Microsoft VM that must be enabled at startup. You can enable that mode by running SetDebug.exe, as described in the next section. ActiveX debugging enables the ActiveX debugger under both Internet Explorer and Jview.

The ActiveX debugging mode of the Microsoft VM is enabled by the following registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM\ActiveXDebug.

This mode of the Microsoft VM has two side effects that reduce the performance of the Microsoft VM:

To improve normal performance, you may wish to only enable the ActiveX debugging mode in the Microsoft VM while debugging Java classes.


Using SetDebug.exe

A utility application called SetDebug.exe is provided to enable and disable the ActiveX debugging mode of the Microsoft VM, and to add and remove path elements from the source path. SetDebug is installed in the Windows directory.

Invoking SetDebug without any arguments displays a dialog box that allows you to enable or disable the ActiveX debugging mode of the Microsoft VM. It creates or deletes the ActiveXDebug registry key.

Typing "SetDebug -?" displays a description of the SetDebug command-line options:


    Usage:
    -d		Disable ActiveX debugging for Java.
    -e 		Enable ActiveX debugging for Java.
    -p <path>	Append <path> to the Java source path.
    -r <path>	Remove <path> from the Java source path.
 

For example, typing "SetDebug -p c:\Sources" appends the path c:\Sources to the source path. Typing "SetDebug -r c:\Sources" removes it.


Java Source Code

Source code for most of the Java system classes is included in this release.

The Microsoft VM can read the Java source code from the Classes.zip file just like it reads the Java classes from that file. You don't need to unzip the Classes.zip file unless you want to view the source code of the system classes outside the debugger.

The Microsoft VM searches for the source code for Java classes similar to the way that it searches for class files. The Microsoft VM searches for a source file by searching the source path, and then the class path. Source code for a class must be located in the same package as the class. This does not necessarily mean the same container, however. For example, if you your class path is set to include the c:\Classes directory and your source path set to include the c:\Sources directory, the Microsoft VM could find the tree.Util class as c:\Classes\Tree\Util.class and the tree.Util source code in c:\Sources\Tree\Util.java.

The Microsoft VM reads the source path from the SourcePath string value of the HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM registry key. The Microsoft VM reads the class path from the ClassPath string value of the same key. The source path value can be manipulated using SetDebug with the -p or -r command-line options. ). . . . -->


Notes on Using the Debugger

The debugger comes up with the Java class tree view fully expanded. You can expand or collapse package views by clicking the plus/minus sign (+/-) to the left of a package name.

The debugger can still break and step in methods for which it does not have source code. For example, when you invoke Break at Next from the Edit menu in Internet Explorer, the debugger breaks in the class, but no source code or bytecode disassembly is displayed. If you can't tell where you are, look at the Call Stack window.

From the debugger, it can be difficult to tell whether the applet being debugged is in a running state or in a break state. To help determine this, look at the Call Stack window, which will display "<Running>" while the applet being debugged is executing, and a call stack when the applet is stopped in the debugger. Also, the toolbar execution buttons are unavailable while the applet is executing, and available when the applet is stopped in the debugger.

Using the Immediate Window

The JAutoExp.dat file that is installed in the Windows directory allows you to customize the way Java classes are displayed in the Immediate window. See that file for details.

You cannot evaluate expressions that include Java methods in the Immediate window.

You might encounter bugs when attempting to display or set the value of a Java variable in the Immediate window.

Using the Thread List Window

The Thread List window, which is in the debugger, may get out of sync with the threads executing in the Microsoft VM.

The preceding issues will be addressed in future releases of the Microsoft VM.

Top© 1997 Microsoft Corporation. All rights reserved. Terms of Use.