Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have some strange problems with a java console on my 10.04 server (it's actually the console of a minecraft-server, but I believe it's a general problem and not something minecraft specific): arrow keys aren't recognized properly. Whenever they are used inside the java console, they produce something like this:

^[[A ^[[B ^[[C ^[[D

They work fine on the rest of the system, though.

I have already tried several things like checking system-locales or setting specific locales for java only but without any luck. Any ideas what's the reason behind it and how it could be fixed?

Thanks in advance.

edit (Oct 29): After reading the first answer and testing several things, I figured out some more about this issue. There is now program running on top of the shell, the issue is mostly caused by problems with java's jline library that is used by the java application (or its console, to be more specific).

For testing purpose I switched to from OpenJDK6 to OrcaleJDK6 and the issue was gone. Testing OpenJDK7 is not possible as there is no version for 10.04. I assume some connections with jline since this is the library responsible for handling console out- and input. Probably the version used by the application is somehow incompatible with the older OpenJDK version used on the server. But compatible with the more up-to-date version of oracle-java I installed manually. I still have not figured out how ubuntu's jline-package fits into this picture. For me there is no difference between testing with and without it.

Will edit this post again if I figure out something. If anybody has an idea, please let me know.

share|improve this question

1 Answer 1

Some console programs (it may be a program running on the top of the bash, such as sh ) do not suppress the control key presses such as Up arrow or down arrow etc. In those consoles, You will also get the echo of the key presses like you posted ^[[A ^[[B ^[[C ^[[D. It's not a big problem actually.

Your default shell is bash which suppresses the key strokes of arrow keys. Unlike bash, the sh shell doesn't suppress the arrow key strokes. You can try it by running sh on a terminal and pressing the arrow keys. To exit from those consoles, you need to use certain command specific to the programs, most of the time, it is quit or exit.

share|improve this answer
    
Thanks for this detailed and helpful answer. After reading the page you linked, I figured out my case may be different (see edit for more infos). –  thee Oct 29 '12 at 18:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.