Attaching a Java debugger to the Scala REPL

I’m using the Scala REPL to play around with java libraries and check their runtime behaviors. One of the things I’m using it for is to check how Voldemort’s client is behaving in different setups. For one of the checks I wanted to trace the client threads with an IDE debugger.
To attach a debugger to the Scala REPL all you need to do is to export the debugger values into JAVA_OPTS:

export JAVA_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,address=1773,server=y,suspend=n'

Run your scala REPL and attach your debugger to port 1773. Done.

(*) Tested with scala 2.7