Fork me on GitHub
#reveal
<
2020-10-16
>
seancorfield06:10:34

So... it turned out the above actually did work -- I just didn't notice the new window that had opened up with Reveal in it! It has pretty much no styles applied so it's a bit hard to read, and it's light theme instead of dark theme, but it does actually work, so it is sort of bearable to use for debugging a legacy process...

vlaaad06:10:59

hmm, does slurp on that string work?

vlaaad06:10:22

i.e. (println (slurp "cljfxcss:?vlaaad.reveal.style/main#1522973323"))

vlaaad06:10:57

what does (com.sun.javafx.css.StyleManager/getErrors) say?

seancorfield16:10:54

@vlaaad

java.io.FileNotFoundException: "cljfxcss:?vlaaad.reveal.style/main#1522973323 (No such file or directory)"
and this produces nil
( "cljfxcss:?vlaaad.reveal.style/main#1522973323")
and (com.sun.javafx.css.StyleManager/getErrors) produces nil

vlaaad16:10:19

It's not a resource, it's url that cljfx/css library instructs jvm to load from the registry...

vlaaad16:10:31

What's in java.protocol.handler.pkgs system property after requiring reveal?

vlaaad17:10:42

Hmm, looks ok

vlaaad17:10:19

Does setting it to "cljfx.css" help?

seancorfield18:10:30

@vlaaad Can you be more specific about when/where to set that?

seancorfield18:10:53

I can start the legacy app and connect via a REPL. Should I set that property before or after requiring vlaaad.reveal? And did you mean "cljfx.css" or "cljfxcss" which is what appears to be the protocol on that style loading operation?

vlaaad18:10:16

I had this in mind: 1. require 'cljfx.css 2. set`java.protocol.handler.pkgs` system property to "cljfx.css" (without leading |) 3. require reveal

seancorfield19:10:58

Gotcha. OK, let me test that.

seancorfield19:10:34

Nope. Same problem.

vlaaad19:10:20

actually, you can try just this one-liner to check if it's about protocols:

(slurp (:cljfx.css/url ((requiring-resolve 'cljfx.css/register) ::style {"x" {:x 1}})))

vlaaad19:10:24

does it return anything to you? I found some zulu jdk (windows), but it didn't have JavaFX built in. Nonetheless, this code doesn't throw for me

seancorfield19:10:59

There are two different Zulu JDK packagings: a regular one and a version with JFX bundled in.

seancorfield19:10:14

"cljfxcss:?ws.dev.repl/style#1691341505 (No such file or directory)"

seancorfield19:10:27

(ws.dev.repl is the ns I was in when I ran that code)

seancorfield19:10:31

Here's the result of that register call:

{"x" {:x 1}, :cljfx.css/url "cljfxcss:?ws.dev.repl/style#1691341505"}

vlaaad19:10:39

okay, I found the JDK with JavaFX

vlaaad19:10:46

this is what I have:

ws.dev.repl=> (ns ws.dev.repl)
nil
ws.dev.repl=> ((requiring-resolve 'cljfx.css/register) ::style {"x" {:x 1}})
{"x" {:x 1}, :cljfx.css/url "cljfxcss:?ws.dev.repl/style#1691341505"}
ws.dev.repl=> (slurp (:cljfx.css/url ((requiring-resolve 'cljfx.css/register) ::style {"x" {:x 1}})))
"x {\n  x: 1;\n}\n"

vlaaad19:10:26

I can't reproduce your issue, unfortunately

vlaaad19:10:39

perhaps I need different OS?

vlaaad19:10:10

maybe there are some additional restrictions on the JVM, like extending url protocols is somehow forbidden?

vlaaad19:10:36

I launched my with this incantation:

PS C:\Users\Vlaaad\Downloads\zulu8.48.0.53-ca-fx-jdk8.0.265-win_x64\zulu8.48.0.53-ca-fx-jdk8.0.265-win_x64\bin> .\java.exe -cp $(clj -Sdeps "{:deps {cljfx/css {:mvn/version """"1.1.0""""}}}" -Spath) clojure.main

seancorfield19:10:34

OK. Thanks for trying. The application context I'm working in is somewhat complicated unfortunately.

seancorfield17:10:36

@vlaaad I'm beginning to believe that the context in which I'm trying to start Reveal has already called URL/setURLStreamHandlerFactory which can only be called once per application and which installs a stream handler factory that is "swallowing" the cljfxcss protocol and throwing an exception instead of returning nil (which would then cascade down to the java.protocol.handler.pkgs check).

vlaaad17:10:16

Hmm, I'm not sure what I can do about this...

seancorfield17:10:51

Bah. Just confirmed that is not the case. There is no existing stream handler factory in place.

seancorfield17:10:28

I checked that I can slurp from a .URL created with an explicit instance of the cljfx.css.cljfxcss.Handler class. So the class is present and the handler actually does its job.

seancorfield17:10:48

I suspect it may be a class loader issue that prevents the jfx code (in the Zulu package) from seeing the cljfx.css.cljfxcss.Handler after the Clojure code is loaded.

seancorfield18:10:12

I think at this point I'm just out of luck for this particular (legacy) environment. Like I said, it's sort of usable even without the stylesheets loaded... so I can live with it.