Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

I have had success debugging Clojure code with JSwat, specifically, version 3.16 on Mac OS X. You can start Clojure under JSwat, but with limited input capabilities. Better is to attach JSwat to a running instance of Clojure. You have to start Java with these flags to support remote debugging:

Code Block
java \-Xdebug \-Xrunjdwp:transport=dt_socket,server=y,suspend=n ...

When Clojure starts it will print something like:

Code Block
Listening for transport dt_socket at address: 63657

Then in JSwat choose Attach... and put localhost for Host and the socket address for Port. In JSwat, open up some Clojure file you have loaded, (including boot.clj) and you can set breakpoints in Clojure source. Breakpoints, call stack, local variable views and step debugging (within Clojure code and from Clojure to Java and back) all work. You can also attach to Clojure when it is started as the inferior Lisp in Emacs. Best of all, if you change a .clj file and reload it, JSwat will pick up the changed file and you can set breakpoints etc in the new code without stopping and restarting JSwat or Clojure.