reveal

Docs: https://vlaaad.github.io/reveal/ Source: https://github.com/vlaaad/reveal
seancorfield 2020-10-16T06:06:34.080800Z

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...

vlaaad 2020-10-16T06:35:59.081200Z

hmm, does slurp on that string work?

vlaaad 2020-10-16T06:36:22.081600Z

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

vlaaad 2020-10-16T06:38:57.081800Z

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

seancorfield 2020-10-16T16:39:54.083Z

@vlaaad

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

vlaaad 2020-10-16T16:43:19.083100Z

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

vlaaad 2020-10-16T16:44:31.083200Z

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

seancorfield 2020-10-16T16:58:30.083400Z

"|cljfx.css"

vlaaad 2020-10-16T17:00:42.083500Z

Hmm, looks ok

vlaaad 2020-10-16T17:01:19.083600Z

Does setting it to "cljfx.css" help?

seancorfield 2020-10-16T18:49:30.084400Z

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

seancorfield 2020-10-16T18:50:53.085900Z

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?

seancorfield 2020-10-17T17:14:36.089500Z

@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).

vlaaad 2020-10-17T17:53:16.089700Z

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

seancorfield 2020-10-17T17:53:51.089900Z

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

seancorfield 2020-10-17T17:55:28.090100Z

I checked that I can slurp from a <http://java.net|java.net>.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.

seancorfield 2020-10-17T17:57:48.090300Z

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.

seancorfield 2020-10-17T18:06:12.090500Z

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.

vlaaad 2020-10-16T18:55:16.086200Z

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

seancorfield 2020-10-16T19:09:58.086400Z

Gotcha. OK, let me test that.

seancorfield 2020-10-16T19:14:34.086600Z

Nope. Same problem.

vlaaad 2020-10-16T19:15:20.086800Z

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}})))

vlaaad 2020-10-16T19:16:24.087Z

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

seancorfield 2020-10-16T19:23:59.087300Z

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

seancorfield 2020-10-16T19:26:14.087500Z

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

seancorfield 2020-10-16T19:26:27.087700Z

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

seancorfield 2020-10-16T19:27:31.087900Z

Here's the result of that register call:

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

vlaaad 2020-10-16T19:29:39.088100Z

okay, I found the JDK with JavaFX

vlaaad 2020-10-16T19:29:46.088300Z

this is what I have:

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

vlaaad 2020-10-16T19:30:26.088500Z

I can't reproduce your issue, unfortunately

vlaaad 2020-10-16T19:30:39.088700Z

perhaps I need different OS?

vlaaad 2020-10-16T19:33:10.088900Z

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

vlaaad 2020-10-16T19:33:36.089100Z

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&gt; .\java.exe -cp $(clj -Sdeps "{:deps {cljfx/css {:mvn/version """"1.1.0""""}}}" -Spath) clojure.main

seancorfield 2020-10-16T19:34:34.089300Z

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