Getting started with Clojure on Ubuntu
Filed under: clojureClojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system. Clojure is predominantly a functional programming language, and features a rich set of immutable, persistent data structures. Clojure runs on the JVM.
To get satisfactory results on Ubuntu, I suggest the following setup:
- Remove all the java-gcj stuff that Ubuntu probably has installed:
$ sudo aptitude remove java-gcj*
- Install the Sun Java binaries:
$ sudo aptitude install libjline-java sun-java6-jdk sun-java6-jre ant
- Download and install git head of Clojure:
$ git clone git://github.com/richhickey/clojure.git $ cd clojure $ ant $ java -cp clojure.jar clojure.main
If the last line presents you with the Clojure REPL (Read-Evaluate-Print-Loop) prompt ("user=>"), then you are have Clojure successfully running.
Next, we want to move Clojure to a more sane place (I chose /usr/local/lib/clojure):
$ cd .. $ sudo mv clojure /usr/local/lib
Next, we want Jeffrey Chu's Clojure Extras:
$ wget http://github.com/jochu/clojure-extra/zipball/master -O clojure-extra.zip $ unzip -p clojure-extra.zip "*clojure.conf.sample" > .clojure.conf $ sudo unzip -p clojure-extra.zip "*clojure" > /usr/local/bin/clojure $ sudo chmod 755 /usr/local/bin/clojure
Next, edit ~/.clojure.conf and change/uncomment the following lines:
clj=/usr/local/lib/clojure/clojure.jar clj_ext=~/.clojure clj_wrapper=jline.ConsoleRunner
Although I don't understand why you should need to, I had to link the jline jar file into ~/.clojure, otherwise java couldn't find it:
$ ln -s /usr/share/java/jline.jar ~/.clojure
Next, install clojure-contrib:
$ git clone git://github.com/richhickey/clojure-contrib.git $ cd clojure-contrib $ ant $ cp clojure-contrib.jar ~/.clojure
At this point you should have a fully functional Clojure install. Just type "clojure" at the command prompt.






