This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
My name is Carl and I'm a 20 year-old novice learning Clojure, Python and Java. I have Clojure running on a virtual Linux Distro, but I like having the flexibility of running it on Windows as well.
This guide will help you set up Clojure on Windows 7 with leinigen and emacs live.
Note : All the steps below apply to Windows 7 64 bit. If anyone has experience setting this up on other Windows operating systems, feel free to include some extra details in the reply posts.
1)First things first, you need java to be able to run Clojure, so make sure you have the latest build installed.
Get it from here:
I'm not a huge fan of the Windows terminal because of it's limited horizontal resizability, so I like to use console2 which is quite neater.
Get it free from here: http://sourceforge.net/projects/console/
I would suggest going to the administrative user directory and create a \local\bin there. For example:
Extract all of the zip files you downloaded. This may take a while.
Cut and paste the lein.bat and the wget.exe into your \bin folder.
Cut and paste your emacs-24.1 folder and your console2 folder into your \local folder.
5)Now you need to set up your path variables:
You can either click on your profile picture in the start menu and click on "Change my environment variables".
go to your Control Panel
Open the System icon
Open the Advanced system settings
Path Environment Variables
If you're on a fresh installation of Windows 7, or you simply don't have the PATH variable, then
click on "New"
In the variable name, call it PATH
In the variable value, copy and paste the directory of your java\jre7\bin folder (or whatever version of java you're using) and add the following :
6)Open console2 and go to your administrative user directory. (you can make this the default directory by opening edit -> settings and changing your start directory to C:\Users\Carl for example)
Type in java, if the console doesn't complain that it can't find java then your PATH is set up correctly.
Type in lein self-install : using wget, it will connect to github automatically and download the leiningen jar. This may take a while.
7)Go to your start menu and type runemacs and open it, then close it. (this is to create a .emacs.d folder in your roaming directory)
8)Copy your emacs-live-master folder
In the Start Menu type in %APPDATA%, click on roaming and paste your emacs-live-master folder here. Once it's done copying, rename it to .emacs.d
9)Head back to the console and type in lein, it should download some additional files. Once that is finished, leinigen is now properly set up.
Type in lein again, and it should run it.
Then you can create a new project by going to whichever directory you want by typing in (for example):
lein new cljtest
10)Open runemacs again and it should load emacs live. Holding the ctrl key, hit x then f to find a file. And go to the directory where you created your project. For example:
and type in project.clj and hit enter.
11)In order to open an nREPL server, simply hold the alt key and hit x, then type in nrepl-jack-in and hit enter. This might take a while.
Congratulations! You are now successfuly running clojure in Windows.
Note: The default mode is paredit and it might take some time to get use to it. There are numerous guides out there helping you to learn paredit features.