[JavaFX] Application.launch / Running Processing (FX2D) in the same VM more than once.

I am running processing form java.

I've found that FX2D is the only renderer that currently does what I need in 2D space and is also performant enough.

One of the conditions in JavaFX is that Application.launch can only be called once in the same JVM.

So if I am starting and monitoring an instance of Processing in the same VM I can't close it and restart a new instance without restarting the whole VM.

There are quite a few threads on the subject, this direction seems promising for my use case. But unfortunately I don't know enough about Processing internals to know if this is already implemented or is possible for me to adjust outside of the source.

In the same vein, launching a Processing application as a new thread and monitoring it is working fine. Unfortunately if I properly exit out of FX2D it wants to shut down the whole JVM, not just the thread it is in. Is there a way around that, while still cleaning up the resources used by Processing?

tl;dr

  1. Is there a way for me to run Processing (FX2D) in the same JVM more than once.
  2. How do I properly exit the sketch running inside a thread without exiting the parent application that started the thread.

Thanks

Sign In or Register to comment.