This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Get Clojure and emacs live running in Windows

 
Busquared Eleven
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings to you all.

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:
http://www.java.com/


2)You will need the self-contained version of Wget which is (in essence) a non-interactive download utility:
http://nebm.ist.utl.pt/~glopes/wget/

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/

3)Now you will need leiningen, which allows you to manage your Clojure projects:
Get it directly from here : https://raw.github.com/technomancy/leiningen/stable/bin/lein.bat

(or you can manually go to the github leiningen site, and scroll down to windows and right-click and save the batch file)

4)Next you will need emacs live which has some incredible features for Clojure, so head over to
http://ftp.gnu.org/gnu/emacs/windows/

and download the latest version of emacs. (should be 24.3 as of December 2013)

Then download the zip file of emacs live from here:
https://github.com/overtone/emacs-live

Now you should have the following list of files:

Console-2.00b148-Beta_32bit.zip
emacs-24.3-bin-i386.zip (or greater)
emacs-live-master.zip
lein.bat
wget-1.11.4-x64.zip


I would suggest going to the administrative user directory and create a \local\bin there. For example:

C:\Users\Carl\local\bin

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 :

;%USERPROFILE%\local\bin;%USERPROFILE%\local\Console2;%USERPROFILE%\local\emacs-24.3\bin

I just copied and pasted mine for simplicity but if you have a later version of emacs make sure to make the right adjustements.

The variable value should look something like this:

C:\Program Files (x86)\Java\jre7\bin;%USERPROFILE%\local\bin;%USERPROFILE%\local\Console2;%USERPROFILE%\local\emacs-24.3\bin

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):

mkdir Projects

cd Projects


lein new cljtest

cd 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:

c:/Users/Carl/Projects/cljtest

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.





1.jpg
[Thumbnail for 1.jpg]
3.png
[Thumbnail for 3.png]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for posting this. You said the default mode is paredit. I hadn't realized the default mode for emacs had a name; that was good to learn.
 
giovanni pinotto
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, thanks for the tutorial.

First, after I run emacs, I won't find any .emacs.d folder inside roaming folder

also I'm gettin this error:



when I type in

how can I solve these? (win 8.1 x64)

thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic