Java – tab based autocompletion in console applications

I am writing a console based Java application. In this application, a user-defined command will be displayed to prompt her where she can type some commands. I want to implement an automatic completion function for the application. When typing commands, if the user presses tab, the commands should be completed This function is similar to the autocomplete function in the Linux command prompt

In the Java console application, we can't control tab, and the tab pressed will append 8 spaces by default I need some tips. Using tab without rendering, my application can replace tab with autocomplete

Thank you in advance

Solution

You can try libraries like Java - readLine or jline2

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>