我正在做来自Clojure in Action第232页的Compojure示例
(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))但当我尝试运行它时:
$ 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)
...看起来这句话
(:use compojure)我还听说最近的compojure版本之间有了很大的变化。在设置这个compojure应用程序时,我做错了什么?有没有一个很好的在线教程来帮助我上手?
发布于 2013-04-05 13:24:47
您可能希望尝试将use语句更改为:
(:use compojure.core)
这应该就行了。
不久前,我为compojure创建了一个样板模板,其中有一个工作示例,您可以查看here。
更好的是,如果你正在使用Leiningen --你应该这样--你可以简单地创建一个新的compojure项目,如下所示:
$ lein new compojure hello-world
查看compojure的Getting Started了解更多信息。
https://stackoverflow.com/questions/15826137
复制相似问题