HOWTO: Sending Text to the Visual J++ Output WindowID: Q195175
|
There are several ways to send debug text strings to the Visual J++ Output window for diagnosing runtime problems. These methods will work only when you launch your application from the Visual J++ environment. Applications launched standalone will not be able to access the Output window.
The first way to send text strings to the Visual J++ Output window is by
using the print and println methods of the com.ms.debug.Debugger.out
package. When you call these methods from a Java application that is
spawned from JVIEW or WJVIEW in either debug or release builds, the text
string will appear in the Visual J++ Output window.
Here is a simple sample that demonstrates using the println method:
public class Class1 {
public static void main (String[] args) {
com.ms.debug.Debugger.out.println("Hello World");
}
}
When this class is built and run from within Visual J++, you will see the
string "Hello World" appear in the Visual J++ Output window. Notice that
the string is output whether you build your application in Debug or Retail
mode.
private void button1_click(Object source, Event e) {
com.ms.wfc.util.Debug.println("Hello World");
}
Notice that if you build your form in Debug mode (selectable in the Project
Properties dialog box), the text string will appear in the Visual J++
Output window when you click button1. If you then build your application in
Retail mode and execute from Visual J++, the text will no longer appear in
the Output window. In fact, the method call will no longer exist in your
code.
Q194187 Redirecting WFC Debug Output to the VJ6 Output WindowThis article demonstrates how to redirect this output from the Console window to the Visual J++ Output window so that you can utilize the benefits of Conditional Compilation in your Java Console applications as well.
Java Method Call | WJVIEW Retail Build | WJVIEW Debug Build |
---|---|---|
System.out.println | VJ Output Window | VJ Output Window |
com.ms.debug.Debugger.out.println | VJ Output Window | VJ Output Window |
com.ms.wfc.util.Debug.println | no Output | VJ Output Window |
Java Method Call | JView Retail Build | JView Debug Build |
---|---|---|
System.out.println | MS-DOS Console | MS-DOS Console |
com.ms.debug.Debugger.out.println | VJ Output Window | VJ Output Window |
com.ms.wfc.util.Debug.println | no Output | MS-DOS Console |
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Steve Horne, Microsoft Corporation
Additional query words:
Keywords : kbVJ600 kbSDKJava310 kbSDKJava320
Version : WINDOWS:3.1,6.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 9, 1999