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的问题?