我在我的項目上運行了lein uberjar
,它創建了相應的jar文件。當我運行一個ClassNotFoundException: explodingdots.core
的jar被拋出。我指定explodingdot.core
作爲我的主要課程。我提取了jar文件,並且在相應的目錄中確實沒有core.class
。我忘了什麼?'lein jar'和'lein uberjar'沒有正確設置主類
我在src/explodingdots/core.clj
(ns explodingdots.core (:import (java.awt Color Dimension Graphics2D AlphaComposite RenderingHints) (java.awt.event ActionListener MouseAdapter WindowAdapter) (javax.swing Timer JPanel JFrame)) (:gen-class)) [ ... ] (defn -init[] exploding-dots) (defn -main[_] (let [ed (new explodingdots.core)] (.init ed)))
下面的代碼我project.clj
內容是:
(defproject explodingdots "0.1" :dependencies [[org.clojure/clojure "1.2.0"] [org.clojure/clojure-contrib "1.2.0"]] :main explodingdots.core)
注:我使用leiningen 1.3.1
嘗試添加選項:main true:前綴「 - 」到gen-class表單。 – Isaac 2010-09-09 15:25:50
我很確定他不應該那樣做。 – Rayne 2010-09-09 16:11:17
事實上,我通過* remove *'修正了一個與這個非常相似的問題:'main true' – 2011-11-12 18:00:35