Proper way to use subclassed JavaFxHtmlPanel

Answered

Hi,

I wonder what's the proper way of subclassing `com.intellij.ui.javafx.JavaFxHtmlPanel` and using it in my plugin?

Having `org.openjfx.javafxplugin` in `build.gradle` leads to a conflict:

com.intellij.diagnostic.PluginException: While loading class javafx.scene.web.WebView: loader constraint violation: loader com.intellij.ide.plugins.cl.PluginClassLoader @4d761e83 wants to load class javafx.scene.web.WebView. A different class with the same name was previously loaded by 'platform'. (javafx.scene.web.WebView is in module javafx.web@11.0.6 of loader 'platform')

 

whereas trying to run without `org.openjfx.javafxplugin` issues: class file for javafx.scene.web.WebView not found

Should I stop using Gradle for JavaFX and setup libraries manually, or am I missing something?

 

IntelliJ IDEA 2019.3.4  #IU-193.6911.18, bundled runtime

0
12 comments

Igor,

Why you just can't use JavaFxHtmlPanel from the IntelliJ SDK?

In addition - with 2020.1, JCEF will be available.

0

Jakub,

I wanted to subclass it to access .load() from WebView's engine (need a fullfeatured rendering from a remote).

JCEF looks promissing too. Is there ETA for JCEF on PyCharm?

0

You can extend com.intellij.ui.javafx.JavaFxHtmlPanel class with your own so you'll have access to the myWebView property.

PyCharm 2020.1 RC is already available.

0

I've already subclassed it and made a custom method to access .load(). Method call leads to the exceptions described.

0

But what's the reason of having org.openjfx.javafxplugin in your Gradle if you're using the bundled one?

0

That was "trying to run without `org.openjfx.javafxplugin` issues: class file for javafx.scene.web.WebView not found" as mentioned above.

0

Can you provide some sources (or just a minimal reproducible repository) so I can run it locally and check what's going on?

0

Sure, thank you. https://yadi.sk/d/AVCispNb0ZNIvw

I'm probably missing something in the configuration.

0

Ok, the issue is reproducible when building plugin with Java 1.8. 

With Java 11 it builds and runs correctly.

 

Ref: https://openjfx.io/openjfx-docs/#install-java

-1

Hm,

openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)

0

Just to make sure - do you have Java 11 set also in the following Preferences?

Preferences | Build, Execution, Deployment | Build Tools | Gradle > Gradle JVM
-1

Yes: Use Project JDK (java version "11.0.6", path: /usr/lib/jvm/java-1.11.0-openjdk-amd64)

0

Please sign in to leave a comment.