Processing and JavaFX

This topic needs to be revisited, because there appears to be a simpler way. On my Windows 11 system I have been able to run a javafx demo without using a separate ‘code‘ folder. I did this by copy/pasting all the javafx.xxxx.jar files into the following address: C:\Users\s\Documents\Processing\libraries\javafx\library\javafx.xxxxx.jar. These jar files have been buried in a ‘modules‘ folder inside of the native operating system folder, but need to be at the location above to be picked up by the source code. I tested this technique on Linux and it also works there. You can test this by running the following demo:

import javafx.scene.canvas.Canvas;
import javafx.scene.layout.StackPane;

Canvas canvas;
StackPane root;

void setup(){
 size(350,200,FX2D);  
 surface.setTitle("JavaFX in Default Wnd");
 canvas = (Canvas)surface.getNative();
 root = (StackPane)canvas.getParent();
}

void draw(){
  fill(0,255,0);
  circle(width/2,100,100);
}

Output: