« Google SMS | Main | Curiosity killed the geek »

Remote Java debugging with emacs

With the retirement of the sun server I used to work on at work (RIP cortez) I have moved operations to all-linux-all-the-time, which also means using Subversion (no more ClearCase!), emacs on linux - not sun, JBoss not weblogic and newer JDE (2.3.3).

It was when I tried to debug something today that I discovered I was used to a rather ancient version of JDE on my sun box. Attaching a debugger with that version required writing a JDE extension and setting up some cryptic things in .emacs. None of that works anymore, particularly since jde-db-init doesn't even exists as of 2003 or so.. obviously I was used to a very ancient version of JDE.

Thankfully, setting up the newer one to attach to an external process proved to be very, very easy.

in .emacs:


  1. Location of source:
    jde-sourcepath ( "/home/ktrapszo/src" )

  2. Debugger socket:
    jde-db-option-connect-socket (nil, "28380")

    Default socket is 4444

That's all it takes to setup JDE to attach to a remote process with jdb. Easy!

Of course, the second part of that is running JBoss in debug mode.

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:server=y,transport=dt_socket,address=28380,suspend=n

Easy, more reading: JDEE page

Comments

So you don't like ClearCase? I've never used it so I don't know. I switched from CVS to Subversion months ago and think Subversion is pretty great.

I've no doubt ClearCase is very useful to someone -- I just never met them. I found it slow, buggy and annoying to use, of course I've only used it for about 3 1/2 years, maybe it takes getting used to.

I like the Eclipse debugger for Java.

JBoss got their own JBoss IDE Plugin Set for Eclipse as well.