aspose file tools*
The moose likes Blog around the Campfire and the fly likes Get Clojure and emacs live running in Windows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Blog around the Campfire
Bookmark "Get Clojure and emacs live running in Windows" Watch "Get Clojure and emacs live running in Windows" New topic
Author

Get Clojure and emacs live running in Windows

Busquared Eleven
Greenhorn

Joined: Dec 16, 2013
Posts: 1
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.







[Thumbnail for 1.jpg]

[Thumbnail for 3.png]

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30516
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
giovanni pinotto
Greenhorn

Joined: Jan 12, 2014
Posts: 1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get Clojure and emacs live running in Windows