Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Read the console with JLine 2 not working?!

  1. #1
    Junior Member
    Join Date
    Apr 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Read the console with JLine 2 not working?!

    Hey guys

    I tried to get the current line of the java console via JLine 2. Here is the code of the attempt:

    reader = new ConsoleReader();
    String line;
    while ((line = reader.readLine()) != null) {
        System.out.println("LINE FOUND!");
    }

    But this does not work, neither in the IDE (Eclipse) nor in GitBash

    Do you have any idea, what I did wrong?

    Thanks in advance

    PT400C

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Read the console with JLine 2 not working?!

    this does not work,
    Please explain what "not work" means?
    Are there errors?
    What do you expect the code to do when it is executed?

    Are you sure there is a console for input inside of those IDEs? Have you tried executing the code in a command prompt?

    What package is the ConsoleReader class in?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Read the console with JLine 2 not working?!

    First of all, there are no errors (sadly).
    I expect the code to post "LINE FOUND!" into the console after typing something in the console and pressing enter.
    And I am NOT sure wether Eclipse supports this type of input but GitBash, as I told above, does also not work.

    PT400C

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Read the console with JLine 2 not working?!

    Have you tried executing it in a command prompt window?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Apr 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Read the console with JLine 2 not working?!

    Well, I am sorry. I was pretty sure that GitBash was capable of java console input.

    Sorry

    PT400C

Similar Threads

  1. Replies: 1
    Last Post: November 2nd, 2012, 02:21 PM
  2. [SOLVED] Read double from console without having to read a string and converting it to double.
    By Lord Voldemort in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: June 26th, 2011, 08:08 AM
  3. [SOLVED] Read double value from console
    By Lord Voldemort in forum What's Wrong With My Code?
    Replies: 7
    Last Post: June 24th, 2011, 01:15 PM
  4. Reading user input from the console with the Scanner class
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 0
    Last Post: November 11th, 2008, 02:47 PM
  5. How to Read user input from the console with InputStreamReader in Java?
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 0
    Last Post: May 19th, 2008, 06:48 AM

Tags for this Thread