10

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

SvenK
  • 2,584
  • 2
  • 21
  • 24
  • 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 :) – Jaime Hablutzel Jul 24 '11 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). – Jaime Hablutzel Jul 24 '11 at 20:41
  • I use the vim editor inside eclipse sometimes (http://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. – SvenK Jul 24 '11 at 21:40

3 Answers3

9

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!

eatnumber1
  • 4,688
  • 1
  • 13
  • 6
  • [rlwrap-jdb](https://github.com/pimlott/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. – teichert Oct 24 '16 at 15:56
5

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.

doak
  • 809
  • 9
  • 24
  • 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. – Gunther Schadow Mar 13 '21 at 14:49
  • @GuntherSchadow, iirc I used it to complete function names to be able to set a breakpoint there. – doak Apr 01 '21 at 10:06
-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 :

Saurabh Gokhale
  • 53,625
  • 36
  • 139
  • 164
  • You mean Jython as a Java scripting interface, I don't know, isn't it easier to write some logging instructions into the code? – SvenK Jul 25 '11 at 11:45