I am using IntelliJ on windows. I have based a simple example on the example here
https://github.com/jline/jline2/blob/master/src/test/java/jline/example/Example.java
Jline 2.12
--
package com.example;
import jline.console.ConsoleReader;
import java.io.IOException;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) throws IOException {
ConsoleReader reader = new ConsoleReader();
reader.setPrompt("p> ");
String line;
PrintWriter out = new PrintWriter(reader.getOutput());
while ((line = reader.readLine()) != null) {
System.out.println(line);
out.println("Echo: " + line);
out.flush();
}
}
}
--
Nothing comes out after the first prompt when I run within IntelliJ.
"C:\Program ...
p> Nothing happens after return
It works when I run in a normal cmd window.
This is symptomatic of System.in not being wrapped in a BufferedReader like so:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Can I force this behavior somehow?