Clojure startup script
I’ve been toying around with Clojure recently. In order to start clojure easily, I created a startup script similar to the ones found in the Wikibooks “Getting Started” page for Clojure. Except I used Ruby, because it started to get too complicated for pure shell script.
First, it assumes that you want to run from the latest Clojure and clojure-contrib sources, so it’ll prepend both clojure.jar
and clojure-contrib.jar
to the CLASSPATH
.
It will also update the CLASSPATH
, so you can simply drop new jars into ~/classes
and the script automatically picks them up if they aren’t already in the CLASSPATH
.
It supports both rlwrap and JLine, although you probably shouldn’t use both at the same time. Since rlwrap doesn’t compile under Snow Leopard anyway, I only use JLine.
It also detects if you have Processing installed, and includes all the jars you need to get clj-processing running. Also, this part is
OS X specific, since it assumes all the p5 stuff is inside Processing.app, located under /Applications
. However, if you don’t have it installed, or aren’t running on OS X, it simply won’t include it.
To use it yourself, you’ll probably want to update the CLOJURE_DIR
and CLOJURE_CONTRIB_DIR
to point at your clones. I use Git for tracking their respective sources. Rich Hickey has mirrors of you can find the repo for both Clojure and clojure-contrib on GitHub:
- Clojure on GitHub: git://github.com/richhickey/clojure.git
- Clojure-contrib on GitHub: git://github.com/richhickey/clojure-contrib.git
And if you put your own jars somewhere else, simply update the custom_classes_path
to point to that directory.