Does Intellij SDK work with JavaFX?


My plugin works with swing and I want migrate it to JavaFX, but to no avail.
I tried to execute my plugin as JavaFX application and got:

Exception in Application start method
java.lang.RuntimeException: Exception in Application start method
 at com.sun.javafx.application.LauncherImpl.launchApplication1(
 at com.sun.javafx.application.LauncherImpl.access$000(
 at com.sun.javafx.application.LauncherImpl$
Caused by: java.lang.NullPointerException
 at javafx.scene.Scene$5.invalidated(
 at javafx.scene.Scene.setWidth(
 at javafx.scene.Scene.init(
 at javafx.scene.Scene.<init>(
 at javafx.scene.Scene.<init>(
 at mypackage.plugin.Main.start(

My actionPerformed method implementation:

public void actionPerformed(AnActionEvent anActionEvent) {

:| Does Intellij SDK work with JavaFX? I'm using JDK 7.

UPDATE: After a some research I found the root of problem:

java.lang.ClassNotFoundException: javafx.scene.layout.AnchorPane
    at com.intellij.util.lang.UrlClassLoader.findClass(

Are someone solved this problem? I added jfxrt.jar to the list of dependencies with runtime scope, but anyway getting same error

After a long unsuccessful attempts I finally done it!
Implementation of Application class:

public void start(Stage primaryStage) throws Exception{
    FXMLLoader loader = new FXMLLoader();
    Parent root = (Parent)loader.load();
    primaryStage.setScene(new Scene(root, 615, 244));

Implementation of AnAction class:

private Stage stage;

public void actionPerformed(final AnActionEvent event) {
    PlatformImpl.startup(new Runnable() {
        public void
run() {

private void initialize() {
    try {
        Main main = new Main();
        if (stage == null) {
            stage = new Stage();
    } catch (Exception e) {

And of course don't forget to add jfxrt.jar to the list of dependencies with runtime scope.

Because of some nasty bug with overlaying of one window to other and answer of Peter Schmitz, Intellij Plugin written in Java FX will not works correctly. For details see answers below.

Comment actions Permalink

One problem of your approach is its missing portability.

It works because you included a copy of the JavaFX library from your runtime environment into your plugin.jar

Alternatively, use Build->Prepare for deployment  and take a look into your deployment ready jar-file. It includes a copy of
the jfxrt.jar from your machine and won't work in another OS.

As far as I understand it, the best solution should work with either the "Provided" setting for jfxrt.jar or no setting at all. Maybe throw in a check if the class is known to allow backwards compatibilty to JRE6 and alternative JREs

The setup described above was previously called 'ugly' (but working) approach in my thread (see ).
But thank you for providing the key aspects of it (the ClassLoader), since I haven't got around to upload an example to play around with

Comment actions Permalink


Thank you for your reply.

In addition to above I want to add that Intellij has some nasty bug with overlaying of one window to other (e.g. in case of switching between a few Intellij windows). If you will use the Intellij plugin written in Java FX you will have the same problem: In case of re-opening your plugin, Intellij will overlay it. Thus, summarizing I can say with confidence that Intellij Plugin written in Java FX will not works correctly and I'm wondering that JetBrains team still did not care about it. :(

Comment actions Permalink

Probably a part of them not caring about it is the fact that plugins using JavaFX can still not be used on OSX, since on that platform JDK 1.6 is still the recommended JDK for running IntelliJ.

Comment actions Permalink

All my tests were conducted on Window 7 and Windows 8.1


Please sign in to leave a comment.