JDK-8096920 : JavaFX state is not properly cleaned after destroying all JavaFX components
  • Type: Bug
  • Component: javafx
  • Sub-Component: application-lifecycle
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2014-08-28
  • Updated: 2015-06-12
  • Resolved: 2014-08-28
Related Reports
Duplicate :  
Description
JavaFX state is not properly cleaned after destroying all JavaFX components. 
It will result on an exception if you create a new JavaFX component.

Steps to reproduce:

1 - Create a SWT application and add a FXCanvas
2 - Dispose the FXCanvas. The application will no longer have JavaFX components.
3 - Create a new FXCanvas.
4 - The application will throw "java.lang.IllegalStateException: Not on FX application thread"


Problems:

When the last JavaFX component is destroyed, the JavaFX shutsdown and cleans the state, but not properly. 
The static fields "initialized" at "com.sun.javafx.application.PlatformImpl" and "application" at "com.sun.glass.ui.Application" stays dirty.
Comments
Closing as a duplicate. To keep the FX toolkit from shutting down until you are ready for your application to exit, you should do call the following: Platform.setImplicitExit(false);
28-08-2014

This is not a P1 bug (blocker), but is rather a known limitation of the toolkit. There is a feature request, RT-14073, to track the request to allow for restarting the FX runtime, but this is not currently planned for any release.
28-08-2014