Re: [問題] PrintStackTrace
try the following code:
import java.io.File;
import java.io.PrintStream;
public class exToFile {
public static void main(String[] args) {
File f = null;
PrintStream ps = null;
int a = 0;
try {
f = new File("debug.out");
ps = new PrintStream(f);
a = 1/0;
}
catch(Exception ex){
if (ps != null){
ex.printStackTrace(ps);
}
}
}
}
Environment:
===============================================
JDK : 1.5_02
OS : windows 2k Svr Sp4
IDE : Eclipse 3.2.2
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.67.10.34
討論串 (同標題文章)