Calling exit() using FX2D renderer doesn't stop program



I’ve noticed that when I call exit(); in a program using the FX2D renderer, an error appears in the console: Not on FX application thread; currentThread = JavaFX Application Thread. This error usually appears when the program is not correctly shut down.

The Java app also stays open, while the sketch window is closed, and the only way it seems to be able to close the thread is to within the IDE stop it.

Is there a way to get around this, so it’s possible to exit the program, and can anyone else replicate this error?

Here’s what creates the error for me:

void setup() {




Does the same happen with

void setup() {
  size(100, 100, FX2D);
void draw() {
void keyPressed() {

? I can’t test because FX2D doesn’t work at all for me.


Yes, calling exit(); anywhere causes the error.


using processing IDE 3.4

  • win 7 32bit
    works fine
  • raspberry pi Raspbian
    can not start:
java.lang.RuntimeException: You need to use "Import Library" to add processing.javafx.PGraphicsFX2D to your sketch.
	at processing.core.PApplet.makeGraphics(
	at processing.core.PApplet.createPrimaryGraphics(
	at processing.core.PApplet.initSurface(
	at processing.core.PApplet.runSketch(
	at processing.core.PApplet.main(

no idea what import i need?
testing also P2D P3D on raspberry
show me a black background window,
the “key” exit works,
but i get following red console info:

EGLDisplayUtil.EGLDisplays: Shutdown (open: 1)
EGLDisplayUtil: Open EGL Display Connections: 1
EGLDisplayUtil: Open[0]: 0x1: EGLDisplayRef[0x1: refCnt 2]

and for openprocessing

FX2D is not defined


You don’t need any libraries for the error to appear. Is an error thrown if you run this code?

void setup() {


Is an error thrown if you run this code?

NOT on windows 7 / processing IDE 3.4
YES on Raspberry ( see above )

possibly you tell us your working environment?


I’m using a MacBook air on High Sierra.

Can any other Mac users see the error?



void setup() {

…I see the error

Not on FX application thread; currentThread = JavaFX Application Thread

on macOS Sierra 10.12.6, MacBook Pro 13" 2016.

@Sarah, have you considered reporting this to


Thanks for testing it out! I was waiting to report it because it seemed like no other users got it, but it seems that it’s a Mac related error.

I’ve opened an issue now: