当我执行程序并使用jline的ConsoleReader或BufferedReader进行读取时,输入的内容将被输入但未显示。例如,我输入asd
,我的控制台不显示asd
,但是当我按Enter键时,它告诉我Could not find command 'asd'. Type 'help' for help
因此,我输入的字符串会被读取,但不会显示。
Windows命令提示符,启动脚本:
@echo off
java -jar PixelCloud.jar
pause
我尝试将我的代码放入线程中,使用扫描仪,使用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.