Menu

readLine() not workgin

Help
TomK
2010-01-15
2013-05-30
  • TomK

    TomK - 2010-01-15

    Hi,

    I'm trying to integrate JLine into my console application but I cannot get readLine() to work.

    I'm basically doing the following:

    ConsoleReader reader = new ConsoleReader();
    String input = reader.readLine("input> ");

    but readLine doesn't wait for the ENTER key, and returns immediately after the first key is pressed.
    This happens on Windows (using JDK 1.6_0_18) and Ubuntu (JDK 1.6.0_2)

    Can I configure JLine so that readLine() waits until the ENTER key is pressed or do I need to do that myself?

    Thanks

     
  • TomK

    TomK - 2010-01-16

    OK, I found the reason.

    Apparently there is a problem when System.console() is also used after JLine has been initialized.

    After I removed calls to System.console() JLine is now working properly.

     

Log in to post a comment.