Following Brian's example of using JLine, this worked quite well.
Finally, I could use up / down to view the history of commands, but it had some disadvantages, such as support for ALT + DEL (for deleting the last word), CTRL + LEFT / RIGHT (for moving the cursor one word back / forward) and CTRL + R (reverse search commands).
Then I found out that such features are offered by JLine2 , so I spent some time on this.
It was a rather painful journey, since I am now on OpenSUSE 12.3, I will not bore you with all the details, but I will talk about them in case you are really interested in this and follow a similar journey:
- JLine2 is only offered with source (at least on OS12.3), so there is no easy rpm installation
- This requires maven to create it (which the official OpenSUSE 12.3 repositories do not offer, but, fortunately, there is an unofficial number made for it)
- Since I am creating it from work, Maven had problems with the proxy server, so I had to provide the proxy data in the /usr/share/maven2/conf/settings.xml file.
- Then, when I typed " mvn install ", there were problems with several maven project dependencies that I had to download + install manually ("maven-scm-api-1.5.jar", jansi-1.11.jar "and" bsh-2.0b4 .jar ")
- After that, it was finally created, but had launch problems, but I solved them using the one mentioned here
After that it worked fine, I get most of the privileges that I missed with JLine1, but unfortunately the jdb ">" hint seems to interfere with cursor movement during CTRL + LEFT / RIGHT actions, which is a shame.
I currently get around this by typing CTRL + P and then CTRL + N (this seems to clear the ">" prompt and do all right)
SIDE-NOTE: It was painful for me to enter a large long command to run jdb using jline, so I found it more convenient to run jline2 + jdb through a bash script, for example:
#!/bin/sh
For example, you could run your program through jline + jdb much easier:
jjdb.sh -classpath './*':'../lib/*' myprogram.MyMainClass
Ok, hope this helps anyone who pulls a little more. If you need more details on any of my travels, let me know, I keep quite detailed magazines, but just did not want to burden the reader with too detailed information (unless you need it! :))