Comments (18)
@victorb I created #17 for this discussion, it's a separate issue.
@ahungry does lein work for you if you create project with different name (not cljfx
)?
from cljfx.
Here is a minimal lein example I tried:
project.clj
:
(defproject lein-cljfx-test "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.10.0"]
[cljfx "1.2.9"]]
:main lein-cljfx-test.core)
src/lein_cljfx_test/core.clj
:
(ns lein-cljfx-test.core
(:require [cljfx.api :as fx])
(:gen-class)
(:import [javafx.application Platform]))
(defn -main [& args]
(Platform/setImplicitExit true)
(fx/on-fx-thread
(fx/create-component
{:fx/type :stage
:showing true
:scene {:fx/type :scene
:root {:fx/type :v-box
:children [{:fx/type :label
:text "Hello from lein!"}]}}})))
Run from command line:
lein run
After running this command a window appeared with "Hello from lein!" text, can you try it and check if it works?
from cljfx.
Caused by: java.io.FileNotFoundException: Could not locate cljfx/api__init.class, cljfx/api.clj or cljfx/api.cljc on classpath.
Same error.
java -version
openjdk version "11.0.3" 2019-04-16
This is consistent on both Ubuntu 18.04 and Arch Linux (latest updated).
from cljfx.
Can you post full stack trace?
from cljfx.
I use Ubuntu 19.04, had Ubuntu 18.04 before and had no such problems, hope there is something more in the stack trace. Also I'd try to print java and clojure versions from running program (without requiring cljfx.api
) — I've seen before lein using different java version when running program because of 1.8 being on the environment
from cljfx.
What version of lein
are you using? What's in your ~/.lein/profiles.clj
file? (often things in there interfere with running some projects)
from cljfx.
lein --version
Leiningen 2.8.3 on Java 11.0.3 OpenJDK 64-Bit Server VM
Stacktrace:
Exception in thread "main" Syntax error compiling at (cljfx/core.clj:1:1). [20/144]
at clojure.lang.Compiler.load(Compiler.java:7647)
at clojure.lang.RT.loadResourceScript(RT.java:381)
at clojure.lang.RT.loadResourceScript(RT.java:372)
at clojure.lang.RT.load(RT.java:463)
at clojure.lang.RT.load(RT.java:428)
at clojure.core$load$fn__6824.invoke(core.clj:6126)
at clojure.core$load.invokeStatic(core.clj:6125)
at clojure.core$load.doInvoke(core.clj:6109)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invokeStatic(core.clj:5908)
at clojure.core$load_one.invoke(core.clj:5903)
at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
at clojure.core$load_lib.invokeStatic(core.clj:5947)
at clojure.core$load_lib.doInvoke(core.clj:5928)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$load_libs.invokeStatic(core.clj:5985)
at clojure.core$load_libs.doInvoke(core.clj:5969)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$require.invokeStatic(core.clj:6007)
at clojure.core$require.doInvoke(core.clj:6007)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at user$eval140$fn__144.invoke(form-init5339610884014396360.clj:1)
at user$eval140.invokeStatic(form-init5339610884014396360.clj:1)
at user$eval140.invoke(form-init5339610884014396360.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:7176)
at clojure.lang.Compiler.eval(Compiler.java:7166)
at clojure.lang.Compiler.load(Compiler.java:7635)
at clojure.lang.Compiler.loadFile(Compiler.java:7573)
at clojure.main$load_script.invokeStatic(main.clj:452)
at clojure.main$init_opt.invokeStatic(main.clj:454)
at clojure.main$init_opt.invoke(main.clj:454)
at clojure.main$initialize.invokeStatic(main.clj:485)
at clojure.main$null_opt.invokeStatic(main.clj:519)
at clojure.main$null_opt.invoke(main.clj:516)
at clojure.main$main.invokeStatic(main.clj:598)
at clojure.main$main.doInvoke(main.clj:561)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate cljfx/api__init.class, cljfx/api.clj or cljfx/api.cljc on classpath.
at clojure.lang.RT.load(RT.java:466)
at clojure.lang.RT.load(RT.java:428)
at clojure.core$load$fn__6824.invoke(core.clj:6126)
at clojure.core$load.invokeStatic(core.clj:6125)
at clojure.core$load.doInvoke(core.clj:6109)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invokeStatic(core.clj:5908)
at clojure.core$load_one.invoke(core.clj:5903)
at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
at clojure.core$load_lib.invokeStatic(core.clj:5947)
at clojure.core$load_lib.doInvoke(core.clj:5928)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$load_libs.invokeStatic(core.clj:5985)
at clojure.core$load_libs.doInvoke(core.clj:5969)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$require.invokeStatic(core.clj:6007)
at clojure.core$require.doInvoke(core.clj:6007)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at cljfx.core$eval157$loading__6706__auto____158.invoke(core.clj:1)
at cljfx.core$eval157.invokeStatic(core.clj:1)
at cljfx.core$eval157.invoke(core.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:7176)
at clojure.lang.Compiler.eval(Compiler.java:7165)
at clojure.lang.Compiler.load(Compiler.java:7635)
... 40 more
from cljfx.
java -version
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.04.1)
OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.04.1, mixed mode, sharing)
Nothing in lein profiles directory.
Maybe I'll find time to make a minimal sample Dockerfile that can reproduce this issue.
from cljfx.
Can you show me an output of lein run
if you change src/lein_cljfx_test/core.clj
like that?
(ns lein-cljfx-test.core)
(defn -main [& args]
(println *clojure-version*)
(println (System/getProperty "java.vm.version")))
from cljfx.
{:major 1, :minor 10, :incremental 0, :qualifier nil}
11.0.3+7-Ubuntu-1ubuntu218.04.1
from cljfx.
Well, requirements are met.. Can you try effectively the same snippet using JavaFX only to see if it's related to cljfx or javafx?
To do it, modify project.clj
to be like that:
(defproject lein-cljfx-test "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.10.0"]
[org.openjfx/javafx-base "12"]
[org.openjfx/javafx-graphics "12"]
[org.openjfx/javafx-controls "12"]]
:main lein-cljfx-test.core)
And src/lein_cljfx_test/core.clj
to be like that:
(ns lein-cljfx-test.core
(:import [javafx.application Platform]
[javafx.scene Scene]
[javafx.stage Stage]
[javafx.scene.control Label]
[javafx.scene.layout VBox]))
(defn -main [& args]
(Platform/startup #(prn :started))
(Platform/runLater
#(doto (Stage.)
(.setScene (Scene.
(doto (VBox.)
(-> .getChildren (.add (Label. "Hello from lein"))))))
(.show))))
from cljfx.
That worked with direct inclusion, I received the GUI printing Hello from lein as expected.
from cljfx.
Hmm, not sure what to do next... I also noticed that exception has (cljfx/core.clj:1:1)
in it, but cljfx does not have a cljfx/core.clj
file, is it a file you created yourself and required cljfx.api
from it? Maybe lein
is confused and expects to find cljfx/api.clj
in your source directory? Or it can't properly add cljfx
to your classpath for some reason and lein clean
can help? What is lein deps :tree
output for you when cljfx is present in :dependencies
?
from cljfx.
Yea sorry, my entry point file for this project was created with lein new app cljfx
vs lein new app lein-cljfx-test
, so thats essentially referencing the lein-cljfx-test core from your given instructions.
At least deps.edn works well with this
from cljfx.
Can you try with differently named lein project? It might be that lein thinks that cljfx
is your project, not a dependency, because they have the same name.
from cljfx.
@vlaaad another thing. Seems lein uberjar
never finishes it's build, unsure of why. Seems there is maybe some issue with when clojure runs the classes static initializer and something gets started, which never gets closed afterwards.
Copying the example you made above:
(ns lein-cljfx-test.core
(:require [cljfx.api :as fx])
(:gen-class)
(:import [javafx.application Platform]))
(defn -main [& args]
(Platform/setImplicitExit true)
(fx/on-fx-thread
(fx/create-component
{:fx/type :stage
:showing true
:scene {:fx/type :scene
:root {:fx/type :v-box
:children [{:fx/type :label
:text "Hello from lein!"}]}}})))
Runs fine with lein run
(and thanks to setImplicitExit
, also exits the full application when closing the javafx application)
However, running lein uberjar
with that example, leads to the lein getting stuck at Compiling lein-cljfx-test.core
forever (seemingly, I let it run for 20 minutes)
Running strace -f lein uberjar
also confirms that it's waiting for something, but that something never happens.
Any advice on what could be happening?
(using clojure 1.10.0 + cljfx 1.2.10 with both openjdk and jdk version 11)
from cljfx.
@vlaaad I can confirm after a rename of the project, no more issue. Thanks for the assist and feel free to close this :)
from cljfx.
Glad that it worked for you!
from cljfx.
Related Issues (20)
- Spinner Example
- controlsfx, CheckComboBox HOT 7
- depstar is deprecated and archived; switch to tools.build HOT 2
- The example project fails with (UnsupportedOperationException) HOT 6
- Mouseclick and textfield ?
- Support for CheckBoxTreeItem/CheckBoxTreeCell
- Method for adding another context-like property HOT 1
- Runnning examples/e20_markdown_editor results in NullPointerException: HOT 1
- How do I use StyledTextArea or any new class? HOT 2
- Broken encoding for Sanskrit text in WebView HOT 2
- How do I exit the packaged app on window close or menu quit command HOT 2
- Unable to open DISPLAY HOT 4
- Trying to understand the lifecycle again
- Using cljfx with Gradle HOT 2
- Problem using leiningen HOT 2
- how to pass args to constructors HOT 3
- how to set the background of a region HOT 5
- Children: duplicate children added: when using pie-chart and dynamic rendering HOT 3
- Memory reuse with `fx/ext-instance-factory` HOT 5
- behavior of tree cell factory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cljfx.