使用 Leiningen 部署 Clojure 应用程序
到目前为止,这是我的 project.clj 文件:
(defproject raj "0.0.1-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]]
:keep-non-project-classes true
:main raj.core)
我的 core.clj 文件:
(ns raj.core
(:use raj.core))
(defn -main [& args]
(println "Hello World!!!"))
lein run -m raj.core 很好地显示了 Hello World 消息。所以接下来我尝试 lein uberjar 并得到
Compiling raj.core
Compilation succeeded.
Created C:\Users\bobjones\IdeaProjects\raj/raj-0.0.1-SNAPSHOT.jar
Including raj-0.0.1-SNAPSHOT.jar
Including clojure-1.3.0.jar
Created C:\Users\bobjones\IdeaProjects\raj/raj-0.0.1-SNAPSHOT-standalone.jar
到目前为止一切似乎进展顺利,所以我尝试 java -jar raj-0.0.1-SNAPSHOT-standalone.jar ,并且我收到
Error: Could not find or load main class raj.core
我在这里做错了什么?
This is my project.clj file so far:
(defproject raj "0.0.1-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]]
:keep-non-project-classes true
:main raj.core)
And my core.clj file:
(ns raj.core
(:use raj.core))
(defn -main [& args]
(println "Hello World!!!"))
lein run -m raj.core
displays the Hello World message just fine. So next I try lein uberjar
and get
Compiling raj.core
Compilation succeeded.
Created C:\Users\bobjones\IdeaProjects\raj/raj-0.0.1-SNAPSHOT.jar
Including raj-0.0.1-SNAPSHOT.jar
Including clojure-1.3.0.jar
Created C:\Users\bobjones\IdeaProjects\raj/raj-0.0.1-SNAPSHOT-standalone.jar
Everything seems to be going well so far, so I try java -jar raj-0.0.1-SNAPSHOT-standalone.jar
, and I receive
Error: Could not find or load main class raj.core
What would I be doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将
:gen-class
声明添加到raj.core
命名空间:You need to add a
:gen-class
declaration to theraj.core
namespace: