Closed jpe90 closed 2 years ago
I was able to launch Reveal by switching to a Java 11 JDK FX bundle, but it gives a warning:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by vlaaad.reveal.font$fn__279$fn__280 to method com.sun.javafx.scene.text.FontHelper.getNativeFont(javafx.scene.text.Font)
WARNING: Please consider reporting this to the maintainers of vlaaad.reveal.font$fn__279$fn__280
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
hmm strange, I use JDK 17 myself and I don't have any errors...
btw what do you mean by "FX bundle"?
I just released a new version (Free: 1.3.262
, Pro: 1.3.321
) that completely gets rid of illegal reflective access in font ns, can you give it a try?
btw what do you mean by "FX bundle"?
The only was I was able build projects using JavaFX on my ARM Mac was to use a JDK from Azul that bundles JFX:
I just released a new version (Free: 1.3.262, Pro: 1.3.321) that completely gets rid of illegal reflective access in font ns, can you give it a try?
jon@Jons-MBP java % clj \
-Sdeps '{:deps {vlaaad/reveal {:mvn/version "1.3.262"}}}' \
-X vlaaad.reveal/repl
Downloading: vlaaad/reveal/1.3.262/reveal-1.3.262.pom from clojars
Downloading: vlaaad/reveal/1.3.262/reveal-1.3.262.jar from clojars
Clojure 1.10.3
user=> Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class vlaaad.reveal.font$fn__280 (in unnamed module @0x1f9a075) cannot access class com.sun.javafx.tk.Toolkit (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.tk to unnamed module @0x1f9a075
at vlaaad.reveal.font$fn__280.invokeStatic(font.clj:26)
at vlaaad.reveal.font$fn__280.invoke(font.clj:26)
at clojure.lang.Delay.deref(Delay.java:42)
at clojure.core$deref.invokeStatic(core.clj:2324)
at clojure.core$deref.invoke(core.clj:2310)
at vlaaad.reveal.font$line_height.invokeStatic(font.clj:33)
at vlaaad.reveal.font$line_height.invokePrim(font.clj)
at vlaaad.reveal.style$fn__329.invokeStatic(style.clj:135)
at vlaaad.reveal.style$fn__329.invoke(style.clj:33)
at clojure.lang.Delay.deref(Delay.java:42)
at clojure.core$deref.invokeStatic(core.clj:2324)
at clojure.core$deref.invoke(core.clj:2310)
at vlaaad.reveal.ui$window.invokeStatic(ui.clj:596)
at vlaaad.reveal.ui$window.invoke(ui.clj:563)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.core$apply.invokeStatic(core.clj:669)
at clojure.core$apply.invoke(core.clj:662)
at cljfx.lifecycle$wrap_map_desc$fn__1853.invoke(lifecycle.clj:446)
at cljfx.lifecycle$eval1563$fn__1585$G__1550__1594.invoke(lifecycle.clj:17)
at cljfx.renderer$render_component.invokeStatic(renderer.clj:57)
at cljfx.renderer$render_component.invoke(renderer.clj:47)
at cljfx.renderer$create$fn__2982.invoke(renderer.clj:77)
at cljfx.renderer$perform_render$fn__2933.invoke(renderer.clj:23)
at cljfx.renderer$perform_render.invokeStatic(renderer.clj:22)
at cljfx.renderer$perform_render.invoke(renderer.clj:14)
at cljfx.renderer$request_render$fn__2959$fn__2963.invoke(renderer.clj:44)
at cljfx.renderer$request_render$fn__2959.invoke(renderer.clj:44)
at clojure.lang.AFn.run(AFn.java:22)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
Grr, I need Toolkit access to get some font metrics.. Can you try JDK 17 without javafx built in? It's pulled in as a dependency...
Hmm yeah just tried Oracle JDK17 and it works without an issue.
Nice!
Maybe you could configure some module opens to make the JVM happy... Like adding something like -J--add-opens=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED
opt before -X
. I'm not sure what's the correct string should be after add-opens
though
I'm a little out of my depth to be much help figuring that out haha.. clj -Sdeps '{:deps {vlaaad/reveal {:mvn/version "1.3.258"}}}' -J--add-opens=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED -X vlaaad.reveal/repl
using the JavaFX bundled JDK gave
WARNING: Unknown module: ALL_UNNAMED specified to --add-opens
Clojure 1.10.3
user=> java.lang.IllegalAccessException: class vlaaad.reveal.font$fn__279$fn__280 cannot access class com.sun.javafx.scene.text.FontHelper (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene.text to unnamed module @16954a28
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
at java.base/java.lang.reflect.Method.invoke(Method.java:560)
at vlaaad.reveal.font$fn__279$fn__280.invoke(font.clj:24)
at vlaaad.reveal.font$fn__300.invokeStatic(font.clj:66)
at vlaaad.reveal.font$fn__300.invoke(font.clj:63)
at clojure.lang.Delay.deref(Delay.java:42)
at clojure.core$deref.invokeStatic(core.clj:2324)
at clojure.core$deref.invoke(core.clj:2310)
at vlaaad.reveal.font$char_width.invokeStatic(font.clj:69)
at vlaaad.reveal.font$char_width.invokePrim(font.clj)
at vlaaad.reveal.style$fn__342.invokeStatic(style.clj:46)
at vlaaad.reveal.style$fn__342.invoke(style.clj:33)
at clojure.lang.Delay.deref(Delay.java:42)
at clojure.core$deref.invokeStatic(core.clj:2324)
at clojure.core$deref.invoke(core.clj:2310)
at vlaaad.reveal.ui$window.invokeStatic(ui.clj:596)
at vlaaad.reveal.ui$window.invoke(ui.clj:563)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.core$apply.invokeStatic(core.clj:669)
at clojure.core$apply.invoke(core.clj:662)
at cljfx.lifecycle$wrap_map_desc$fn__1866.invoke(lifecycle.clj:446)
at cljfx.lifecycle$eval1576$fn__1598$G__1563__1607.invoke(lifecycle.clj:17)
at cljfx.renderer$render_component.invokeStatic(renderer.clj:57)
at cljfx.renderer$render_component.invoke(renderer.clj:47)
at cljfx.renderer$create$fn__2995.invoke(renderer.clj:77)
at cljfx.renderer$perform_render$fn__2946.invoke(renderer.clj:23)
at cljfx.renderer$perform_render.invokeStatic(renderer.clj:22)
at cljfx.renderer$perform_render.invoke(renderer.clj:14)
at cljfx.renderer$request_render$fn__2972$fn__2976.invoke(renderer.clj:44)
at cljfx.renderer$request_render$fn__2972.invoke(renderer.clj:44)
at clojure.lang.AFn.run(AFn.java:22)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
If you think of any other strings to try let me know- I'll poke around and see if I can figure anything out as well. Otherwise thank you for helping me get up and running, and I hope you enjoy your holiday :)
I just tried entering --add-opens=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED
under "JVM args" in Intellij using Cursive w/ the project SDK set to the JFX JDK 17 and it works. If I remove the JVM args it fails with the same message. So something must be wrong with the command I originally tried using in a terminal.
I figured I should give it a try because I was having trouble getting reveal + nrepl served up in a terminal to connect with Sublime over nREPL, but launching with Intellij hooked up to a reveal alias in my deps.edn works fine. So I guess I should just use IntelliJ for everything! Thanks again for your help.
You probably can see the whole command that intellij uses to see the difference between it and terminal one
I was thinking the same thing but I can't seem to find the full command.. in Emacs/CIDER it gets written to the messages buffer but I'm still learning my way around IntelliJ
When you launch intellij repl configuration, it's usually at the top of repl side panel
Good news! I found the whole command.
The bad news is that the command is
/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home/bin/java --add-opens=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED -Dclojure.libfile=/private/var/folders/7h/pnz8m4zd28j_sm5v7ssw37340000gn/T/libfile1533.libs "-javaagent:/Users/jon/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.5744.223/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=61454:/Users/jon/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.5744.223/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Users/jon/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.5744.223/IntelliJ IDEA.app.plugins/clojure-plugin/lib/nrepl-0.8.3.jar:/Users/jon/Development/clojure/advent_of_code_2021/src:/Users/jon/.m2/repository/aocd/aocd/0.1.1/aocd-0.1.1.jar:/Users/jon/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar:/Users/jon/.m2/repository/org/clojure/math.combinatorics/0.1.6/math.combinatorics-0.1.6.jar:/Users/jon/.m2/repository/org/clojure/math.numeric-tower/0.0.5/math.numeric-tower-0.0.5.jar:/Users/jon/.m2/repository/vlaaad/reveal/1.3.262/reveal-1.3.262.jar:/Users/jon/.m2/repository/cambium/cambium.codec-simple/1.0.0/cambium.codec-simple-1.0.0.jar:/Users/jon/.m2/repository/cambium/cambium.core/1.1.0/cambium.core-1.1.0.jar:/Users/jon/.m2/repository/cambium/cambium.logback.core/0.4.4/cambium.logback.core-0.4.4.jar:/Users/jon/.m2/repository/clj-http/clj-http/3.12.1/clj-http-3.12.1.jar:/Users/jon/.m2/repository/org/clojure/core.specs.alpha/0.2.56/core.specs.alpha-0.2.56.jar:/Users/jon/.m2/repository/org/clojure/spec.alpha/0.2.194/spec.alpha-0.2.194.jar:/Users/jon/.m2/repository/cljfx/cljfx/1.7.17/cljfx-1.7.17.jar:/Users/jon/.m2/repository/cljfx/css/1.1.0/css-1.1.0.jar:/Users/jon/.m2/repository/org/apache/commons/commons-lang3/3.10/commons-lang3-3.10.jar:/Users/jon/.m2/repository/org/clojure/data.json/2.4.0/data.json-2.4.0.jar:/Users/jon/.m2/repository/org/clojure/tools.logging/1.1.0/tools.logging-1.1.0.jar:/Users/jon/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/Users/jon/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/jon/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/jon/.m2/repository/org/codehaus/janino/janino/3.1.2/janino-3.1.2.jar:/Users/jon/.m2/repository/commons-codec/commons-codec/1.12/commons-codec-1.12.jar:/Users/jon/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar:/Users/jon/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/Users/jon/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/Users/jon/.m2/repository/org/apache/httpcomponents/httpclient-cache/4.5.13/httpclient-cache-4.5.13.jar:/Users/jon/.m2/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar:/Users/jon/.m2/repository/org/apache/httpcomponents/httpmime/4.5.13/httpmime-4.5.13.jar:/Users/jon/.m2/repository/potemkin/potemkin/0.4.5/potemkin-0.4.5.jar:/Users/jon/.m2/repository/slingshot/slingshot/0.12.2/slingshot-0.12.2.jar:/Users/jon/.m2/repository/cljfx/cljfx/1.7.17/cljfx-1.7.17-jdk11.jar:/Users/jon/.m2/repository/org/openjfx/javafx-base/17.0.0.1/javafx-base-17.0.0.1.jar:/Users/jon/.m2/repository/org/openjfx/javafx-controls/17.0.0.1/javafx-controls-17.0.0.1.jar:/Users/jon/.m2/repository/org/openjfx/javafx-graphics/17.0.0.1/javafx-graphics-17.0.0.1.jar:/Users/jon/.m2/repository/org/openjfx/javafx-media/17.0.0.1/javafx-media-17.0.0.1.jar:/Users/jon/.m2/repository/org/openjfx/javafx-web/17.0.0.1/javafx-web-17.0.0.1.jar:/Users/jon/.m2/repository/org/codehaus/janino/commons-compiler/3.1.2/commons-compiler-3.1.2.jar:/Users/jon/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/Users/jon/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.10/httpcore-nio-4.4.10.jar:/Users/jon/.m2/repository/clj-tuple/clj-tuple/0.2.2/clj-tuple-0.2.2.jar:/Users/jon/.m2/repository/riddley/riddley/0.1.12/riddley-0.1.12.jar:/Users/jon/.m2/repository/org/openjfx/javafx-base/17.0.0.1/javafx-base-17.0.0.1-mac-aarch64.jar:/Users/jon/.m2/repository/org/openjfx/javafx-controls/17.0.0.1/javafx-controls-17.0.0.1-mac-aarch64.jar:/Users/jon/.m2/repository/org/openjfx/javafx-graphics/17.0.0.1/javafx-graphics-17.0.0.1-mac-aarch64.jar:/Users/jon/.m2/repository/org/openjfx/javafx-media/17.0.0.1/javafx-media-17.0.0.1-mac-aarch64.jar:/Users/jon/.m2/repository/org/openjfx/javafx-web/17.0.0.1/javafx-web-17.0.0.1-mac-aarch64.jar" clojure.main -i /private/var/folders/7h/pnz8m4zd28j_sm5v7ssw37340000gn/T/form-init3993461567639996177.clj
Apologies for leaving this open, I was able to get launch reveal on the JFX bundled JDK by adding :jvm-opts ["--add-opens=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED"]}
to an alias.
I'll go ahead and close this since it seems to be a weird JDK specific issue, but feel free to re-open if that's not the case. Thanks again for all your help and for creating this tool.
Yay, I'm glad you got it working!
I'm using the Java 17 JDK FX package on an arm-based Mac. When I run the "give it a try" code, it fails to launch and spits out the following: