Menu

redirected input

Help
potzie
2008-03-11
2013-05-30
  • potzie

    potzie - 2008-03-11

    My java program reads from the System input stream. However, when I use JLine, the input never gets to my program. For example, I have tried the following:

    cat myfile.txt | java jline.ConsoleRunner my.package.Class - In this case, my program displays a console prompt - which is the desired behaviour if I don't direct anything into my program...

    I have also tried amending my code to take input using the ConsoleReader and trying:

    cat myfile.txt | java my.package.Class - but to no avail.

    Does anyone have any suggestions?

     
    • potzie

      potzie - 2008-03-11

      I have found the solution: I need to setDirectConsole(false) on my WindowsTerminal to get the desired affect. (I'm using cygwin and windows cmd shell...)

      So I'll just pass a parameter to my program to say which mode to use.
      Thanks for JLine!

       

Log in to post a comment.