The installation of Clojure on Windows is quite an accomplishement in itself. The following steps are those I finally isolated from multiple forums, blogs and painful discoveries. It’s mostly a note for myself.
Grab the last stable version of Leiningen’s .bat file. If you don’t have Wget installed on your machine, install it or put the binary (wget.exe) in the same folder as
lein.bat. In this directory, open the command window and type
lein self-install. This will install leiningen-1.x.x-standalone.jar on your machine. It will probably be in your user directory, depending of your configurations.
Environment variables and the PATH
Copy the path to your new
lein.bat. Then type <win><pause> (windows key and the key to the right of screen lock). Now go in
Advanced system setting,
Environment Variables. Find the PATH variable and click
edit. Now type a semicolon and paste the path to your
lein.bat file. This will make sure you can call Leiningen from anywhere in your command line with the simple “lein”. You should try it now, just to make sure everything is ok.
At this point you have a working installation of Clojure. But surely you want more, don’t you?
Swank Clojure is a server that allows SLIME (the Superior Lisp Interaction Mode for Emacs) to connect to Clojure projects.
To install Swank-clojure, open once again the command line and type
lein plugin install swank-clojure 1.4.0
(Where 1.4.0 is the version you want to install).
If Clojars.org isn’t blocked, (which it is, at my office, God only knows why…) you should see the plugin being downloaded and installed. That’s it.
No, really, that’s it!
Before you try jack-in, you should make a project as described in Leiningen instructions. The most important part before trying anything else is to have a
.clj ready. You must have this file opened in Emacs before you do the magic M-x
If you get an error message complaining about “$SHELL”, type M-x
clojure-swank-command RET and enter “lein jack-in %s” instead of the current value.