HOWTO: Redirect Output from jview or wjviewID: Q179021
|
This article describes two methods that can redirect output from jview or wjview.
jview main > javalog.txt
This works for both jview and wjview.
//
// sample.java
//
import java.io.*;
public class sample {
public static void main(String[] args)
{
if ("true".equalsIgnoreCase(System.getProperty
("com.ms.applet.enable.logging")))
{
try
{
String logdir = System.getProperty("java.home");
PrintStream ps = new PrintStream(new BufferedOutputStream
(new FileOutputStream(new File
(logdir,"javalog.txt"))), true);
// Use the following two lines for SDK 1.5 and 1.5.1:
// System.out = ps; // comment line if using SDK 2.0
// System.err = ps; // comment line if using SDK 2.0
// Otherwise, use the following two lines for SDK 2.0 and greater:
System.setOut(ps); // uncomment line if using SDK 2.0
System.setErr(ps); // uncomment line if using SDK 2.0
}
catch (Exception e)
{
}
System.out.println("sample.java executed successfully!");
}
}
}
For additional information, please see the following articles in the Microsoft Knowledge Base:
Q177177 HOWTO: Enabling Messages Printed Using System.out.println Q173469 How to Enable the Javalog.txt FileFor the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, please see the following pages on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/
http://support.microsoft.com/support/java/
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Carl Frisk, Microsoft Corporation
Additional query words:
Keywords : kbSDKJava300 kbSDKJava310 JMisc kbSDKJava320
Version : WINDOWS:1.0,1.1,1.5,1.51,2.0,2.01,3.0,3.1
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 13, 1999