Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting 'java.lang.RuntimeException: No toolkit found' error on running javafx application with java11

We recently migrated from java 8 to openJdk11. Now I am trying to test my application on windows and ubuntu with using openJdk installed on both OS. I'm able to run it on ubuntu. But same is not executing in windows10 with java11.Error_Message:

enter image description here

java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Unknown Source)
like image 730
anupm Avatar asked Jan 01 '19 09:01

anupm


People also ask

Why am I getting an error when trying to run JavaFX?

You are getting this error because your runtime PATH to javafx is probably incorrect or missing. where $FX-PATH should be set or replaced with mentioned JavaFX path.

Where are the JavaFX-sdk-11 so files?

Check to see that the .so files are in "/opt/javafx-sdk-11/lib" and that you have the dependent libraries on your system. For example: ... Thanks Kevin. It was missing .so files.

Is there a jfxrt jar in JDK 9?

There is no more jfxrt.jar as of JDK 9, so no, that isn't the problem. It looks like it can't load the native libraries. Two things to try to 1. Run with "-Dprism.verbose=true" and "-Djavafx.verbose=true" and see if that gives a better error message. 2. Check to see that the .so files are in "/opt/javafx-sdk-11/lib" and

Why do I get Ava NoClassDefFoundError JavaFX?

But still I get ava.lang.NoClassDefFoundError: javafx/application/Application which indicates that the jre cannot find the FX classes. Show activity on this post. You are getting this error because your runtime PATH to javafx is probably incorrect or missing. where $FX-PATH should be set or replaced with mentioned JavaFX path.


1 Answers

It is possible that JDK, which you have installed on your Windows system, doesn't include JavaFX and you should install it externally.

Read more here: Where can I get pre-built JavaFX libraries for OpenJDK (Windows) or https://stackoverflow.com/a/19529820 or Javafx: No toolkit found exception .

like image 88
jsosnowski Avatar answered Dec 28 '22 09:12

jsosnowski