当我执行我的程序并使用 jline 的 ConsoleReader 或 BufferedReader 读取时,我输入的文本已输入但未显示。例如我输入asd
,我的控制台不显示asd
,但是当我按回车时,它告诉我Could not find command 'asd'. Type 'help' for help
所以我输入的字符串被读取,但没有显示。
Windows 命令提示符,启动脚本:
@echo off
java -jar PixelCloud.jar
pause
我试图将我的代码放在一个线程中,使用 Scanner,使用 BufferedReader,使用 ConsoleReader,但没有一个工作
AnsiConsole.systemInstall();
try {
reader = new ConsoleReader(System.in, System.out);
} catch (IOException e) {
e.printStackTrace();
}
console = new ColoredConsole();
console.sendMessage(Message.TYPE_HELP);
String line;
System.out.println("test");
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while((line = reader.readLine()) != null) {
System.out.println("test2");
Command.dispatchCommand(line);
}
我希望当我键入时asd
,asd
会在我键入时显示。我当前的控制台输出是
Type "help" for help.
test
test2
Could not find command 's'. Type "help" for help.
test2
Could not find command 'hello'. Type "help" for help.