JavaFX Unable to add modules to Processing IDE

Thanks. I’ve seen the github messages, but am looking for ways to solve the problem, which shouldn’t be that difficult in my opinion. Just a few observations:

  1. With Processing 4 the code without a control will run just fine without the first line (import processing.javafx.*) indicating to me that Processing 4 is able to get requisite files from someplace else instead of the libraries folder in Documents/Processing.

  2. When the first line of code is included in Processing 3.5.4 the first thing that happens is an error dialog which says that more than one library is competing for the sketch and one of them has to be removed. The two locations are the libraries javafx folder and the other is in the app bundle. Removing the first line of code in 3.5.4 then allows the sketch to run, so at least for Processing 3.4.5 it appears to be using the libraries in the app bundle.

Therefore, it would seem reasonable to me to try adding the control modules to the app bundle of Processing 4 since my efforts of adding them to the libraries folder (Documents/Processing/libraries/javafx) have failed. I’m doing this on a Mac and from previous experience I have seen that if you alter the bundle on a code-signed app the gatekeeper will automatically disable the app so that it will no longer run. Nonetheless, I’m willing to try knowing that I’ll probably trash Processing 4 in the process, but can just download a new copy if necessary. The experiment would best be done by the Processing team; they could add the libraries to the app bundle and then code-sign the app prior to distribution which should not present a problem. Unfortunately I don’t know how to compile and code-sign the open source code for the Processing IDE. I think it would have to be an Xcode project in order for me to do it without trashing the editor.

Followup:

I just copy/pasted a javafx folder from another app (BlueJ) into the Processing 4 bundle and it accepted it without a problem; the app still runs as expected. This folder contains all the jar files and libraries necessary to add javafx controls to a Processing app; folder contents shown below. Now if we could just recode the Processing IDE to use the folder we should be able to use javafx controls.

Smoking gun?

https://github.com/processing/processing4/blob/3185ebae15f1ee894a9a2a056cc253b4677012e3/java/src/processing/mode/java/JavaBuild.java

line 1079:

 static public String[] getArgsJavaFX(String modulePath) {

    return new String[] {

      "--module-path", modulePath,




      // Full list of modules, let's not commit to all of these unless

      // a compelling argument is made or a reason presents itself.

      //"javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web"

      "--add-modules", "javafx.base,javafx.graphics,javafx.swing",




      // TODO Presumably, this is only because com.sun.* classes are being used?

      // https://github.com/processing/processing4/issues/208

      "--add-exports", "javafx.graphics/com.sun.javafx.geom=ALL-UNNAMED",

      "--add-exports", "javafx.graphics/com.sun.glass.ui=ALL-UNNAMED"

    };

  }

Note that javafx.controls didn’t make the list.

Modules folder:

As it turns out all the requisite jar files and libraries for javafx live here on my system; no need to import them:

But they do have to be hooked up as shown above.