"Toolkit already initialized" error with OpenJDK 11

Kevin Rushforth kevin.rushforth at oracle.com
Wed Sep 26 12:09:02 UTC 2018


I'm' not aware of anything that intentionally changed between FX in JDK 
8 and FX 11, but my guess is that the FX runtime is being shutdown after 
your first FXCanvas exits. Try making the following call (only needed 
one time) before creating your first FXCanvas:

     Platform.setImplicitExit(false);

-- Kevin

On 9/26/2018 4:22 AM, marcel Austenfeld wrote:
> First of all congratulation to the new release and thank you for the hard work on JavaFX.
>   
>   
> I have a problem with JavaFX which in my case is embedded in a Rich Client Platform of Eclipse.
>   
> I integrated several SWT FXCanvas (some with SwingNode panels as a SWT_AWT replacement) into my app.
>   
> This works fine in Java 8 which my current release depends on.
>   
> However in Java 11 after the second panel is initialized at startup I get the following error:
>   
> "Caused by: java.lang.IllegalStateException: Toolkit already initialized"
>   
> Is there a new option available to avoid a new initialization of the toolkit if several FXCanvas are embedded in an application?
> Or do you now any changes since Java 8 which could the cause of such an exception?
>   
>   
> Thanks in advance for any help.



More information about the openjfx-dev mailing list