System.out.print("TEST") don't display on the console in IntelliJ

Answered

I create a Gradle project, an type this code as below, but no display on the console.Please help me,thanks.

public static void main(String[] args) {

new Thread(new Runnable() {

@Override
public void run() {
while(true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.print("TEST");
}
}
}).start();

}
8 comments
Comment actions Permalink

Hello,

What do you see in the "Run" tool window after executing your code? Do you see any error? 

What Run/Debug configuration is in use? 

0
Comment actions Permalink

Hello,

Without any error.

When I stop the program, it prints all thing.

0
Comment actions Permalink

This code work for me.

System.out.println("TEST");

0
Comment actions Permalink

Thank you for the example and screenshots. 

As I see, the issue is specific to Gradle and the similar question has been raised on official Gradle forum: 

https://discuss.gradle.org/t/gradle-print-vs-println/21334

Moreover, IntelliJ IDEA's terminal outputs the string as predictable. 

So, I recommend you to ask that question on StackOverflow, or Gradle forum

0
Comment actions Permalink

I get it. Thanks.

0
Comment actions Permalink

Hello Konstantin Annikov ,

I came across the same problem and I posted this in detail in StackOverflow and then posted it again in a gradle forum as well. I suspect that the problem is with the IntelliJ's implementation as the problem doesn't seem to rise when gradle is used with other IDEs. It is not a big deal but still this bug is kinda irritating. It would be great if you could solve this. Thank you.

0
Comment actions Permalink

Please vote and follow this issue for updates: https://youtrack.jetbrains.com/issue/IDEA-184090

1

Please sign in to leave a comment.