cljfx

https://github.com/cljfx/cljfx
b4 2020-10-27T06:11:38.099700Z

anybody know how to handle this error? Syntax error (ClassNotFoundException) compiling at (cljfx/coerce.clj:1:1). javafx.event.EventHandler

b4 2020-10-27T06:12:22.100500Z

i don't know what i need to handle this in ubuntu.

b4 2020-10-27T06:14:54.101200Z

and it happen when i do (require '[cljfx.api :as fx]) in the repl.

seancorfield 2020-10-27T06:18:35.101800Z

@b4 What JDK are you running on? Did you add the JavaFX dependencies to your project?

b4 2020-10-27T06:19:32.102300Z

java - opendjk 11, javafx.version 15.0.1

b4 2020-10-27T06:20:53.103900Z

should i need to add javafx into project? i just add like this.

b4 2020-10-27T06:21:06.104100Z

:deps {org.clojure/clojure {:mvn/version "1.10.1"} org.openjfx/javafx-controls {:mvn/version "15"} org.openjfx/javafx-base {:mvn/version "15"} org.openjfx/javafx-graphics {:mvn/version "15"} org.openjfx/javafx-media {:mvn/version "15"} org.openjfx/javafx-web {:mvn/version "15"} cljfx {:mvn/version "1.7.10"}

b4 2020-10-27T06:21:49.104800Z

sorry im a beginer, so i try to find a some clue in the internet... but.. still not yet.

b4 2020-10-27T06:24:15.106Z

plz let me know some document if there is about how to setup javafx env.

seancorfield 2020-10-27T06:29:46.106600Z

Hmm, I would have expected that to work. Maybe when @vlaaad is around, he can help...

seancorfield 2020-10-27T06:30:17.107200Z

When I create a new project with those deps and run a REPL and then do that require, it works 😐

seancorfield 2020-10-27T06:30:50.107500Z

(! 617)-> cat deps.edn 
{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.10.1"}
        org.openjfx/javafx-controls {:mvn/version "15"}
        org.openjfx/javafx-base {:mvn/version "15"}
        org.openjfx/javafx-graphics {:mvn/version "15"}
        org.openjfx/javafx-media {:mvn/version "15"}
        org.openjfx/javafx-web {:mvn/version "15"}
	cljfx {:mvn/version "1.7.10"}}
 :aliases
 {:test {:extra-paths ["test"]
         :extra-deps {org.clojure/test.check {:mvn/version "1.0.0"}}}
  :runner
  {:extra-deps {com.cognitect/test-runner
                {:git/url "<https://github.com/cognitect-labs/test-runner>"
                 :sha "b6b3193fcc42659d7e46ecd1884a228993441182"}}
   :main-opts ["-m" "cognitect.test-runner"
               "-d" "test"]}
  :uberjar {:extra-deps {seancorfield/depstar {:mvn/version "1.1.128"}}
            :main-opts ["-m" "hf.depstar.uberjar" "fx.jar"
                        "-C" "-m" "b4.fx"]}}}
(! 618)-&gt; clj
Clojure 1.10.1
user=&gt; (require '[cljfx.api :as fx]) 
nil
user=&gt; 

seancorfield 2020-10-27T06:31:21.107900Z

(that's on JDK 15 but it shouldn't make any difference)

seancorfield 2020-10-27T06:32:05.108300Z

(! 619)-&gt; JAVA_HOME=$OPENJDK11_HOME clj
Clojure 1.10.1
user=&gt; (System/getProperty "java.version")
"11.0.5"
user=&gt; (require '[cljfx.api :as fx]) 
nil
user=&gt; 
Yup, works on openjdk 11 too.

b4 2020-10-27T06:41:44.109900Z

maybe my env is sth wrong. i will try again from zero. anyway thank u very much! 👍👍

vlaaad 2020-10-27T07:19:14.110300Z

on java 9+ javafx deps are pulled in automatically

vlaaad 2020-10-27T07:21:33.112600Z

@b4, could it be that you used java 8 when creating the project, i.e. run clj ... on java 8 so it created and cached a classpath using java 8, and then switched to java 15? In that case you need to use -Sforce or just remove the caches manually

b4 2020-10-27T07:23:50.113800Z

@vlaaad already did it. but not working.

b4 2020-10-27T07:24:13.114500Z

so i delete java and re-install openjdk 15.

vlaaad 2020-10-27T07:24:37.115200Z

what does clj -Stree say in your project dir?

b4 2020-10-27T07:25:05.115700Z

still not working so chang clojure from 1.9.0.381 -> 1.10.1.727 finally working.

b4 2020-10-27T07:25:16.116Z

yes i did it in the project dir.

b4 2020-10-27T07:25:40.116700Z

still i don't know the reason but now it is working.

vlaaad 2020-10-27T07:25:48.116900Z

ah yes, minimum clojure version is 1.10

b4 2020-10-27T07:26:54.117700Z

hm.. but i added clojure 1.10.1 into deps.edn.

vlaaad 2020-10-27T07:28:54.118500Z

¯\(ツ)

b4 2020-10-27T07:36:30.118800Z

anyway thanks ur comment.! 😁

👍 1
b4 2020-10-27T07:40:27.119500Z

and thanks to ur cljfx @vlaaad 👍👍

vlaaad 2020-10-27T07:48:18.119700Z

my pleasure 🙂