I am working on the Compojure example from Clojure in Action page 232
(ns compojure-test.core
(:gen-class)
(:use compojure))
(defroutes hello
(GET "/" (html [:h1 "Hello world"]))
(ANY "*" [404 "Page not found"]))
(run-server {:port 8080} "/*" (servlet hello))
But when I attempt to run it:
$ lein run
Exception in thread "main" java.lang.ClassNotFoundException: compojure-test.core
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
...
it appears that the statement
(:use compojure)
I have also heard that there was a major change between recent versions of compojure. What ma I doing wrong in setting up this compojure app? Is there a good tutorial online to help me get up and running?
You might want to try changing your use
statement to:
(:use compojure.core)
That should do it.
I created a boilerplate template a while back for compojure that has a working example you can see here.
Even better, if you're using Leiningen - which you should - you can simply create a new compojure project like this:
$ lein new compojure hello-world
Checkout compojure's Getting Started for more.