1

I downloaded Clojure 1.2 https://github.com/downloads/clojure/clojure/clojure-1.2.0.zip , extracted it under /Library directory, created CLOJURE_HOME, added $CLOJURE_HOME/script to my $PATH.

When I'm trying to run clj or repl scripts that are located under script directory, I'm getting this error:

Exception in thread "main" java.lang.NoClassDefFoundError: jline/ ConsoleRunner Caused by: java.lang.ClassNotFoundException: jline.ConsoleRunner at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

Ok, jline.jar isn't in the CLASSPATH so I checked clj and repl scripts:

CLASSPATH=src/clj:test:test-classes:classes/:script/jline-0.9.94.jar:../clojure-contrib/target/clojure-contrib-1.2.0-SNAPSHOT.jar

if [ -z "$1" ]; then 
   exec java -server jline.ConsoleRunner clojure.main 
else 
   SCRIPT=$(dirname $1) 
   export CLASSPATH=$SCRIPT/*:$SCRIPT:$CLASSPATH 
   exec java -Xmx3G -server clojure.main "$1" "$@" 
fi

I downloaded jline.jar under $CLOJURE_HOME/script but I'm still getting the same error.

This lead me to the question:
What is the role of https://github.com/downloads/clojure/clojure/clojure-1.2.0.zip anyway?
Is it supposed to be used to install Clojure? or just to to build and get clojure.jar?
I noticed no one is talking about installing Clojure this way.
Am I missing something?

Chiron
  • 20,081
  • 17
  • 81
  • 133
  • Tryed this? http://stackoverflow.com/questions/3218961/clojure-lein-repl-with-jline/3223271#3223271 – koddo Dec 09 '10 at 07:34

2 Answers2

1

Clojure, being a JVM language, has to deal with the JVM classpath. This makes 'installing' it a bit unwieldy and confusing. Rather than install it yourself like this, try out some tools like cljr and cake. I wrote a blog post about this that might be helpful: http://blog.raynes.me/?p=48

In summary: Check out cljr, cake, and leiningen.

The majority of people in the Clojure community don't have Clojure 'installed'. Most people use a build tool and/or cljr. It doesn't make a lot of sense to install Clojure to a central place when, inevitably, you're going to need dependency management, and jars will be copied around everywhere anyway. In any case, it's much easier to let a tool handle the classpath for you.

Rayne
  • 31,473
  • 17
  • 86
  • 101
  • Yes exactly, Clojure developers used to use a build tool or IDE integration. – Chiron Dec 09 '10 at 14:59
  • Huh? They still do use build tools and IDE/text editor integration. That was the point of my answer. :> – Rayne Dec 09 '10 at 15:15
0

the clojure.zip file exists so people who write tools will have a place for their tools to get the parts they need ;)

For people not writing tools they are either working on/with the latest branch from github and so they get Clojure with a git pull or they are using the above mentioned liningen, cake, cljr , counterclockwise(eclipse), la clojure (intellij), or netbeans.

Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284