Java: System.out.println() should write to the console, but it doesn't
console, java
Solution
How are you running your program outside eclipse?
You should use command line like
`java -jar yourjar.jar`
or
`java -cp yourjar.jar ConsoleTest`
If you are occasionally using `javaw` instead no console output will be produced. The STDOUT of `javaw` is `null`. Probably this is what happens when you are clicking on your jar file.
Problem
I am trying to write Java console application, the code is quite simple: ``` public class ConsoleTest { public static void main(String[] args) { System.out.println("test"); } } ``` If I run this application from Eclipse, then i see "`test`" in Eclipse's "Console", but if I export my app as a "Runnable JAR file" and run it from Windows XP `cmd.exe`, then nothing is echoed to the console. On the safe side, i tried to check `System.console()`, it returns `null`. What can be wrong?