8

I've been trying to install Clojure on my computer to learn and use. I'm running Ubuntu 10.04, and have installed the latest Sun Java SDK and environment from Synaptic.

Searching with Google, I found multiple guides that give pretty clear guides on how to go about installing all the dependencies and useful tools and builders like ant, maven, leiningen, and emacs with SLIME.

Some of the guides are a bit dated, especially considering how fast Clojure development moves, so I searched for the most up-to-date one I could. I've been following this guide from December of 2010 and it's very similar to most others.

The one big problem I come up against is at the step where I have to fire up the REPL with

java -cp clojure.jar clojure.main

I see that in the clojure source I've gotten from github.com/clojure/clojure.git and the github.com/clojure/clojure-contrib.git that neither actually have a clojure.jar to point the JVM to...

I think that maybe there's something I'm doing wrong, since no one has had this problem before apparently from my searches on Google. I double checked the repos on Github via a browser and there is no .jar file there either.

So...where do I get this .jar file or is there another way I'm supposed to go about this?

mnicky
  • 1,308
  • 11
  • 24
Sergei R.
  • 163
  • 1
  • 6
  • Oh wow, I feel like an idiot. I realized that since I built clojure with ant and clojure-contrib with maven-2 that they're all ready to use, and that I don't need to do the whole: java -cp clojure.jar clojure.main I just typed in clojure in the terminal and I had the REPL. Sorry for the silly question. I'm new so I can't answer my own question yet. – Sergei R. May 12 '11 at 19:33
  • If you want to create the clojure.jar from source, go to the clojure.git directory and build it with ant by typing "ant". – bmillare Sep 30 '11 at 12:26

1 Answers1

17

FWIW, if you don't have an intense desire to compile stuff, your life will be easier if you just download leiningen or cake, and get one of them to manage all the jars and classpaths and stuff. For example, here's all it takes to get lein running on a vanilla unix system. (I've omitted the screensful of output some of these commands generate to emphasize that you only have to type a few things).

akm@li231-96: ~
$ curl https://raw.github.com/technomancy/leiningen/stable/bin/lein > lein

akm@li231-96: ~
$ chmod +x lein

akm@li231-96: ~
$ ./lein self-install

akm@li231-96: ~
$ ./lein repl
Using JLine for console I/O; install rlwrap for optimum experience.
REPL started; server listening on localhost:60099.
user=> (inc 1)
2

Your experience will be better if you put lein on your PATH somewhere (eg ~/bin) rather than calling it by full path, but it's not at all necessary.

Kzqai
  • 22,588
  • 25
  • 105
  • 137
amalloy
  • 89,153
  • 8
  • 140
  • 205
  • Yeah, I've gone ahead and done all of that from the tutorial guide. I'm having problems setting the path right now (switched default terminal to zsh from bash this week). I'll ask around in irc or something if I don't get it. Thanks. – Sergei R. May 12 '11 at 21:08
  • I could not agree with this answer more! The important point is that you dont have to set the classpaths at all. just in install lein and let lein install clojure and set the classpath. after that you only use lein to start clojure. – Arthur Ulfeldt May 12 '11 at 21:14
  • Ah... technique :) Thanks for the answer. I wanted to start easily with Clojure, and cannot be easier. +1. – Diego Sevilla May 12 '11 at 22:08