This article has been archived because much better Clojure resources are available now. Some of my favorite Clojure learning resources include Learn Clojure and Clojure web applications on Heroku. You can also find commercial support at Clojure Core.
I’ve been meaning to start learning Compojure. This was the perfect kick-start. Thanks!
Thanks for the feedback, rzezeski. Building a Compojure application has been a lot of fun so far. If this article inspires someone else to start building, then it was definitely worth writing. Hopefully I can finish a second article in the next few days.
Pingback: Using PostgreSQL with Compojure « Eric Lavigne
I can only agree with rzezeski, this was a great kickstart! I have developed a couple of small web apps using webjure, another web framework for clojure which runs under Tomcat (or similar, I assume), but development of it seems to have stopped. Also, compojure looked more powerful the last time I checked.
Thanks!
Pingback: Autodidact » Blog Archive » On Clojure: A close look at Luke VanderHart’s Markov Chain generator
Pingback: Clojure roundup « Clojure Study Group DC
hey, thanks for the post, eric. just trying out compojure myself. all your steps seem to work great, until I try to execute the simple web app:
root@arjun:~/site# ./run
Caused by: java.io.FileNotFoundException: Could not locate compojure/http__init.class or compojure/http.clj on classpath:
any thoughts/ideas? sorry for being such a n00b
Arjun, this is definitely NOT your fault. There have been some recent changes to Compojure, and I haven’t yet found time to update these articles.
At the beginning of the program, there are two lines of code for importing libraries:
(use ‘compojure.http)
(use ‘compojure.jetty)
Try changing them as follows:
(use ‘compojure.http.servlet)
(use ‘compojure.http.routes)
(use ‘compojure.server.jetty)
The other articles have similar issues. I hope to fix those issues in the next few days. Until then, please feel free to ask for help with any problems you encounter.
I just finished updating the code in this article for the latest version of Compojure.
If you are still using an old version of Compojure, use the following commands to update to the latest version:
cd /root/install/compojure
git pull
ant
The other two articles also need to be updated. I will place a comment like this one at the bottom of each article after I finish updating them. I hope to finish by the end of the day.
I am preparing to deliver a Clojure presentation to a Java user group in mid-February. I will definitely post my slides later.
awesome, i’m up & running now. thanks, eric.
Thanks Eric for sharing this information.
I’d like to mention there’s more slice set up and lock down tips in the slice setup article for Ubuntu Hardy: http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-page-1
It’s important to disallow root login via ssh, and there are a few more good tips in there.
Welcome to Slicehost.
Thanks, this was really helpful as I set up my blog in Clojure.
Thanks for the good post – you might want to add ant deps before ant (I got
“BUILD FAILED
/home/compojure/install/compojure/build.xml:34: /home/compojure/install/compojure/deps not found.”
until I went to http://en.wikibooks.org/wiki/Compojure/Getting_Started and saw that addition)
You can abbreviate the classpath with “java -Djava.ext.dirs=/root/install/compojure/deps” — there is no need to list every jar individually on the classpath.
Pingback: Setting up clojure « Follow the Data
I needed – in addition to the above – to do the following:
Add the partner sources to sources.list:
deb http://archive.canonical.com/ubuntu karmic partner
deb-src http://archive.canonical.com/ubuntu karmic partner
Change the default jvm:
https://help.ubuntu.com/community/Java
Great article. Here’s the script that ended up working for me, a slightly modified version of one that somebody else linked to:
#!/bin/sh
COMPOJURE_DIR=~/Documents/compojure
CLASSPATH=$COMPOJURE_DIR/compojure.jar
for f in $COMPOJURE_DIR/deps/*.jar; do
CLASSPATH=$CLASSPATH:$f
done
java -cp $CLASSPATH clojure.lang.Script $1
I know this post is old(er), but instead of screen, you can use `nohup`. Also, instead of a massive classpath, you can throw your jars in a `lib` directory and use `java -cp “lib/*” clojure.main page.clj`, which might be easier.