localhost
localhost

Reputation: 1273

How to view IntelliJ console if program exit code was non-zero?

I'm using Intellij IDEA Community 2020.1

When I try to run this super-simple example code:

public class testConsole {
    public static void main(String[] args) {
        System.out.println("Wish I could see this important info");
        System.exit(1);
    }
}

I see the important message flash up in the console for a split-second, then the screen immediately switches to an error about the non-zero exit code:

Execution failed for task ':testConsole.main()'.
> Process 'command 'C:/Program Files (x86)/Java/jdk1.7.0_71/bin/java.exe'' finished with non-zero exit value 1

Is there any way to switch back to the console so I can see what was printed to sysout?

Upvotes: 1

Views: 375

Answers (1)

localhost
localhost

Reputation: 1273

Console button I discovered if I click on the top red exclamation point, I can then scroll up to see the sysout.

I think what was happening is to do with having a warning in another part of the project. When I moved that code into a new project that has no compilation errors, the sysout remains even when there's a non-zero exit code.

Upvotes: 1

Related Questions