I am using Emacs (v24.4) for writing Java applications. I have created a Java library that I am building using Gradle (v2.2) and testing with Spock Framework where I have all my test cases.

I would like to debug my Java code using Emacs. However, I haven't found any way of doing this. I would like to set a breakpoint and step through my Java code.

Here is my Gradle build file:

apply plugin: 'java'
apply plugin: 'groovy'

repositories {

dependencies {
    compile 'org.igniterealtime.smack:smack-core:4.1.0'
    compile 'org.igniterealtime.smack:smack-tcp:4.1.0'

    testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
    testCompile 'org.codehaus.groovy:groovy:2.3.6'

jar {
    baseName = 'SunSmackClient'
    version = '1.0.0'

gradle.projectsEvaluated {
    tasks.withType(JavaCompile) {
        options.compilerArgs << '-Xlint:unchecked'

task wrapper(type: Wrapper) {
    gradleVersion = '2.1'

Example Spock Framework test:

public class SmackClientSpec extends Specification {
    private SmackClient smackClient;

    /* Test 1 */
    def 'Create a connection to XMPP server'() {
        setup: /* Setup connection object */

        def domain = 'domain'  
        def username = 'username'
        def password = 'password'

        SmackClient smackClient = new SmackClient()

        expect: /* Connection to return true */
        smackClient.createConnection(domain, username, password) == true

Many thanks in advance.

  • JDEE used to have several graphical interfaces to JDB, but it was eons ago, and probably makes no sense any more. In general, however, you might be able to use GUD with JDB to achieve that, though I'd probably just use JDB alone. I see the benefit in using GUD only in persisting breakpoints, but I don't know much about it anyway.
    – wvxvw
    Commented Apr 10, 2015 at 8:49
  • Malabar-mode has some debugging of classes with a main method.
    – M Smith
    Commented Apr 12, 2015 at 21:30

1 Answer 1


You might want to check out emacs-eclim which recently added debugging support, using gud, allowing the user to debug remote processes and junit tests alike.

The elisp code making this possible for eclim may at the very least be a good starting point to achieve what you want: https://github.com/senny/emacs-eclim/blob/master/eclim-debug.el

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.