2011-12-25 50 views
15

這是迄今爲止我project.clj文件:部署Clojure的應用與Leiningen

(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 

我會怎麼做錯在這裏?

回答

27

你需要一個:gen-class聲明添加到raj.core命名空間:

(ns raj.core 
    (:use raj.core) 
    (:gen-class))