13

Is there a good commandline debugger for java?

I gave JDB a chance, but the Commandline interface sucks. If I want to change the last line and reexcecute it, I have to retype the whole line. A hit on [UP-ARROW] just gives me "^[[A". Also there is no completion for package/class/methodnames.

GDB is a good alternative but I don't know how to remote debug with it.

I have a Maven/Vim Setup and want to use a console debugger for java, is there a possibility to integrate GDB or another good debugger in this setup?

Greetings Sven

3
  • Command line development is cool! but I think that using an IDE as Eclipse or IntelliJ IDEA gives you those things just out of the box :) Commented Jul 24, 2011 at 20:11
  • I didn't hear about eclim server until now, it seems like an interesting project... and I suppose you are using it because you have vast experience with vim from before... but... why don't you just use Eclipse with vim shortcuts? I was using emacs before but now I really prefer to use an IDE with emacs shortcuts all of the time. By the way... I would recommend you to use IntelliJ IDEA if you haven't tried it before... I have used Netbeans and Eclipse too... but IDEA if far the best of all... but it isn't free, at least the ultimate version (the one that works). Commented Jul 24, 2011 at 20:41
  • I use the vim editor inside eclipse sometimes (eclim.org senario 3), but eclipse is over featured for me, because every feature can be used within vim with a plugin and so I fell back into old plain vim. This raises the question about the commandline debugger. Commented Jul 24, 2011 at 21:40

3 Answers 3

11

Although I haven't found a good replacement for jdb yet, I start jdb wrapped in readline using rlwrap. That way, I get history and full line editing capabilities like in bash. Sadly no completion, but rlwrap supports pluggable completions, so someone could write one!

Sign up to request clarification or add additional context in comments.

1 Comment

rlwrap-jdb uses rlwrap hooks to provide tab-complete and some useful command aliases in addition to the indispensable readline behavior. Note, you will probably run something like rlwrap-jdb jdb -classpath my.jar ... from the commandline.
6

The hint to 'rlwrap' is great!

I now use rlwrap -f . -f tags -e "" jdb <java> <args> which does auto completion based on history and the tags file (created with ctags --recurse) which is pretty usefull. Please refer to man rlwrap for details.

2 Comments

could you add an explanation what the purpose of the ctags is? Is that to make all possible variable names autocompletable? In every context? I suppose it's of no value to have Java keywords completable. I used rlwrap -f . jdb ... the -e "" is not even recognized in my version of rlwrap. But I love it, because I hate the bloat of eclipse and sadly JSwat is no longer supported for JDK beyon 1.5 or so.
@GuntherSchadow, iirc I used it to complete function names to be able to set a breakpoint there.
-5

Here you can get the list of all the command-line debuggers.

Also, not exactly a debugger, but definitely a command-line interface to Java that may help you debug :

1 Comment

You mean Jython as a Java scripting interface, I don't know, isn't it easier to write some logging instructions into the code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.