Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8330998

System.console() writes to stderr when stdout is redirected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 23
    • 22, 23
    • tools
    • None
    • 22
    • b22
    • Verified

      Having code like:

      ---
      public class ConsoleTest {
          public static void main(String... args) {
              System.console().readLine("Hello!");
          }
      }
      ---

      And running it like:

      ---
      $ ~/tools/jdk/jdk-22/bin/java /tmp/ConsoleTest.java >/dev/null
      Hello!
      ---

      Obviously, the text has not been written to stdout, but rather was (presumably) written to stderr.

            jlahoda Jan Lahoda
            jlahoda Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: