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.
Leiningen
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?
Emacs (SLIME)
Swank-clojure
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!
Beginners’ traps
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 clojure-jack-in
!!
If you get an error message complaining about “$SHELL”, type M-x customize-variable
RET clojure-swank-command
RET and enter “lein jack-in %s” instead of the current value.
September 30th, 2012 at 17:52
http://leiningen.org/#install now seems to get the job of installing leiningen done, as long as curl is installed and in the path….
September 30th, 2012 at 22:03
Thanks!
I would like to update this post, but I’m no longer on Windows and can’t test the new leiningen version.
The Emacs/Clojure community convinced me to change my OS. 😉
June 17th, 2016 at 06:58
[…] Clojure on Windows 7 http://frozenlock.org/2012/03/06/clojure-on-windows-7/ […]