The problem is that it’s the responsibility of the terminal emulator (in your case, Eclipse) to process the standard output and the standard error of your application. Without communicating with the terminal emulator, you can never be sure that out
and err
are displayed in the right order. Therefore, I would consider printing everything on err
and redirect it to a file. You can still use out
for clean user interaction.
Nevertheless, there is a (very bad, but strict) solution to your problem:
System.out.println(...);
System.out.flush();
Thread.sleep(100);
System.err.println(...);
System.err.flush();
Thread.sleep(100);
You may have to change the sleep duration depending on your configuration!