Left arrow button is not working in the ouput console
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Left arrow button is not working in the ouput console
Hi,
I am new to Linux. I am having a java program which will read characters from console. i have started my program from bash shell and now the program starts and waiting for the inputs. Say I have typed text , "hello". If i try to move the cursor position back wards using the left arrow button it was not working. Instead some junk characters are printed on the console like ^[[C . Please see the out put text below.
hello^[[C^[[C^[[C^[[C^[[C
Below is my program.
public static void main(String as[]) {
BufferedWriter outputWriter =
new BufferedWriter(new PrintWriter(System.out));
BufferedReader inputReader =
new BufferedReader(new InputStreamReader(System.in));
String command = null;
try {
while (true) {
command = inputReader.readLine();
outputWriter.write("The command is " + command);
}
} catch (Exception e) {
Does the left arrow key work at the console when your Java program is not running? What exactly is the console? What is the value of $TERM?
Thanks for the response. Yes the left arrow is functioning properly for the console when the program is not running. I have started the program from a bash shell. Here by console what I meant is the place where the output of the java program is displayed. This is actually the same bash shell from which the program runs. I have given an attachment which shows the output and terminal details here. Please see it.
Is the console a terminal emulator, a virtual terminal, a physical terminal on a serial port, running an ssh session ... ? The value of $TERM might help. What does the Java program do to read from the console? Which device does or file descriptor does it open and with which options? Do the other cursor movement keys all work OK?
Is the console a terminal emulator, a virtual terminal, a physical terminal on a serial port, running an ssh session ... ? The value of $TERM might help. What does the Java program do to read from the console? Which device does or file descriptor does it open and with which options? Do the other cursor movement keys all work OK?
This program runs from a normal xterm terminal from a Linux machine. The java program starts and it will wait for the input texts the user enters into the console. The problem is there for all the movement keys. The program simply get the value from the console. It's not using any seperate file or device descriptor.
append "stty erase" in your shell profile and try re-login to your account.
Remember, in windows things will work fine except blue screen. But in Linux every thing will work better than what we expect. What we have to do is, we have to use our "BRAIN". With out practicing and understanding the concepts you can't work in Linux. Pl Don't consider this as rude.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.