Is this an eclipse bug?i write something to standard output and err stream,there is something wrong with the order in eclipse
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   yang_shuai
Posted On:   Thursday, December 13, 2007 01:44 AM

Is this an eclipse bug? When i write something out to standard output stream and standard error strem, there is something wrong with the output order in eclipse. the output of the following program in eclipse and in command line is different. class fff { public static void main(String[] args) { try { int i = 8 / 0; } catch (Exception e) { e.printStackTrace(); System.out.println("aaa"); System.err.println("jjj"); } } } the output of eclipse is aaa java.lang.ArithmeticException: / by zero at fff.main(Gz.java:4) jjj and the output in command line   More>>

Is this an eclipse bug? When i write something out to standard output stream and standard error strem, there is something wrong with the output order in eclipse.

the output of the following program in eclipse and in command line is different.

			
class fff {
public static void main(String[] args) {
try {
int i = 8 / 0;
} catch (Exception e) {
e.printStackTrace();
System.out.println("aaa");
System.err.println("jjj");
}
}
}



the output of eclipse is

			
aaa
java.lang.ArithmeticException: / by zero
at fff.main(Gz.java:4)
jjj


and the output in command line is

			
java.lang.ArithmeticException: / by zero
at fff.main(Gz.java:4)
aaa
jjj


what's the problem?

this is my java version and eclispe version

			
D:eclipseworkspace estsrc>java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)


------------------------

eclispe:

Eclipse SDK

Version: 3.4.0
Build id: I20070921-0919
   <<Less

Re: Is this an eclipse bug?i write something to standard output and err stream,there is something wrong with the order in eclipse

Posted By:   Robert_Lybarger  
Posted On:   Thursday, December 13, 2007 08:58 AM

I wouldn't call it a "bug" per se. The issue is that there are two streams that have to be emptied out (out and err) ... just b/c they go to the same device doesn't mean it is merged at the API layer. This means anyone wanting to display both streams needs some way of emptying each of them in turn. Depending on which one is checked first, and how frequently the buffers are cleared out, you can get different output. If there is a lesson involved, it is that you cannot/should not depend on the "order" of a mixed out/err stream showing up the same way.
About | Sitemap | Contact