-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uberjar and compile #5
Comments
I also encountered this issue. |
Can anyone post a stack trace?
|
I don't know how to display the stack trace, but I could cause the problem with this tiny project: project.clj: (defproject fx-clj-test "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0-alpha2"]
[fx-clj "0.2.0-alpha1"]]
:main ^:skip-aot fx-clj-test.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}}) src/fx_clj_test/core.clj: (ns fx-clj-test.core
(:require [fx-clj.core :as fx])
(:gen-class))
(defn make-view []
(fx/button "Hello!"))
(defn -main [& args]
(fx/sandbox #'make-view)) When I executed |
I was able to create an uberjar but that was a while ago and it took some On Wed, Sep 16, 2015 at 10:23 AM, KPCCoiL [email protected] wrote:
|
For me the line https://github.com/aaronc/fx-clj/blob/master/src/fx_clj/impl/bootstrap.clj#L4 prevents AOT, I've commented it out, called it in a fn during app startup and everything works. |
might |
I have hit this problem. The ^:skip-aot did not solve the compilation hang. Removing the line entirely made the compile succeed. But then adding it into the main application made the compile hang again in the main application. Eventually I got the compile working by moving (javafx.embed.swing.JFXPanel.) into the actual mainline code. But then there is a different problem. lein run works. And lein uberjar compiles. But running the jar file with java command line doesn't work giving: java.lang.IllegalStateException: Toolkit not initialized |
You need to call (javafx.embed.swing.JFXPanel.) before you use javafx. You can see a working example here: https://github.com/QAston/URDMI/blob/master/src/urdmi/gui_util.clj (see init-toolkit fn) |
I just remembered that some controls may have static initializers that cause this error. In that case you need to call the static initializer later (lookup the class dynamically instead of refering to it statically from clojure). |
I did call (javafx.embed.swing.JFXPanel.). Does your working example uberjar? To reiterate again:
I have given up on this approach and am now building my JavaFX app by directly extending the JavaFX Application classes via gen-class, as you would build it in Java. When I do this it all works, including the uberjar running under java -jar. |
This is an example of a launcher class that works in AOT and is written in clojure |
Anyone else has problems with uberjar and compile? It just won't complete.
I have to use a Runner class as a workaround and run my clojure code without AOT which results in long startup times when I run the jar file :(.
The text was updated successfully, but these errors were encountered: