vsch / idea-multimarkdown

Markdown language support for IntelliJ IDEA.
https://plugins.jetbrains.com/plugin/7896-markdown-navigator
Apache License 2.0
812 stars 129 forks source link

JavaFX preview doesn't work with newer JVMs #850

Closed jshook closed 4 years ago

jshook commented 4 years ago

The discovery mechanism for JavaFX support doesn't work with the new ways that JavaFX libraries are provided. For example, it could be possible for JavaFX rendering to occur if multimarkdown could detect the presence of the Java 14 JavaFX libs from https://gluonhq.com/products/javafx/.

It seems that jfxrt is not part of this structure. Relying on the Swing preview is painful, so it would be nice to support other distribution forms of JavaFX for preview going forward.

vsch commented 4 years ago

@jshook, thank you for bringing this to my attention.

According to the link you sent me the java application needs to be launched with additional vm options.

I am now looking into how this can be achieved.

vsch commented 4 years ago

@jshook, I have not had a chance to try it but I already installed Java 15 with JavaFX 14. I was hoping that adding --module-path $PATH_TO_FX --add-modules javafx.controls to idea.vmoptions file which is found in the IDE settings. You can set these via main menu "Edit Custom VM Options..."

image

where PATH_TO_FX is path/to/javafx-sdk-14/lib directory.

It is possible that other javafx modules may need to be added to the VM Options.

vsch commented 4 years ago

@jshook, got it working with a small fix to plugin implementation to handle Java 14 exception on trying to get JavaFX debugger api.

What IDE version are you using? I am going to produce an EAP release but would like to support 2020.2 EAP and 2020.1, not 2019.x unless you need these versions.

For example for Java 14 and installation of Gluon JavaFX to /Library/Java/Extensions/javafx-sdk-14.0.1 requires running the IDE with additional vm options:

  --add-exports=java.base/jdk.internal.vm=ALL-UNNAMED
  --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
  --add-exports=javafx.web/com.sun.javafx.scene.web=ALL-UNNAMED
  --module-path /Library/Java/Extensions/javafx-sdk-14.0.1/lib
  --add-modules javafx.controls
  --add-modules javafx.web
  --add-modules javafx.swing
vsch commented 4 years ago

@jshook, EAP release for 2020.1 and 2020.2 added.

EAP update with a fix for the issue is available.

Installing EAP Plugin Version

Please note the change that EAP channel is for JetBrains licensed plugin and Legacy EAP is for legacy licensing by vladsch.com

jshook commented 4 years ago

I've confirmed this works with openjdk 14 as well on 3.0.201.105

Here is a template for others to copy for your JVM settings, as formatted for the idea options file:

--add-exports=java.base/jdk.internal.vm=ALL-UNNAMED
--add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
--add-exports=javafx.web/com.sun.javafx.scene.web=ALL-UNNAMED
--module-path
CHANGE_ME
--add-modules
javafx.controls
--add-modules
javafx.web
--add-modules
javafx.swing

Set CHANGE_ME path to your JavaFX lib directory. The options format only accepts one arg per line, so two-arg forms per line fail on my system.