1
此代碼不能與lein compile
編譯。重要的部分是gen-class
和-main
函數。該代碼使用JavaFX 8和Clojure 1.7,但這些僅僅是特定的。我的問題是關於AOT編譯以及如何引用生成的類。引用來自AOT編譯的Clojure生成的類?
(ns the.app
(:import
[javafx.application Application]
[javafx.scene Scene]
[javafx.scene.layout StackPane]
[javafx.stage Stage])
(:gen-class
:name the.app.App
:extends javafx.application.Application
:main true))
(defn start
[^Application app
^Stage stage
{:keys [width height title] :as opts}]
(let [root (StackPane.)
scene (Scene. root width height)]
(if title (.setTitle stage title))
(.setScene stage scene)
(.show stage)))
(defn -start
[app stage]
(start app stage {:title "App" :width 800 :height 600}))
(defn -stop
[app]
(println "-stop"))
(defn -main
[& args]
(Application/launch the.app.App args))
我project.clj
包含:
:dependencies [[org.clojure/clojure "1.7.0-alpha4"]]
:aot [the.app]
:main the.app
的錯誤信息是:
Caused by: java.lang.ClassNotFoundException: the.app.App
我本來以爲編譯將創造the.app.App
。我怎樣才能解決提到類compiled from AOT的問題?