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












2















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)









share|improve this question

























  • Edit your question and post how you run your app, your command line options, and your JDK/JavaFX SDK versions, so we can help you.

    – José Pereda
    Jan 1 at 12:48













  • Okay. So i have a question. I'm now able to run JavaFX on windows. You know problem was with the JavaFX jar renaming!!. Actually I was building my project on linux and i see that there were 2 jars of each category. one is javafx-base-11.jar and another one javafx-base-11-linux.jar . When i copied these jars to my classpath in windows it was not taking these jars. So i tried to build my project in windows and there i found jars appended with -winn.jar. So my doubt is how it is like that/ These jars are completely different? If i rename -linux with -win it will not work.

    – anupm
    Jan 2 at 9:35













  • Each platform has different jars, with the proper native libraries (.so for linux, .dll for windows), so you can't use one jar on a different platform. You have to use a different JavaFX SDK and you have to distribute a different solution for each platform. See openjfx.io/openjfx-docs

    – José Pereda
    Jan 2 at 9:41











  • So you are telling that javaFX jars are now platform dependent? Then how we will achieve platform independent?? If i build my application in windows then I cannot run it on linux and vice-versa. Isn't it bad? I compared 2 jars (javafx-graphics-11-win.jar and javafx-graphics-11-linux.jar) files and found that these 2 are different. Is there any other approach to use graphics jar from other 3rd party libraries?

    – anupm
    Jan 2 at 11:41











  • Exactly, JavaFX jars are platform dependent, because some of them bundle native libraries for the given platform, like javafx-graphics-11-<platform>.jar. You can do distribution for each platform (via jlink or jpackage), at the end you rely on a VM that is specific of that platform. However, you can still do a fat jar bundling all the jars and native libraries into one. See openjfx.io/openjfx-docs/#modular (section non-modular project).

    – José Pereda
    Jan 2 at 13:28
















2















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)









share|improve this question

























  • Edit your question and post how you run your app, your command line options, and your JDK/JavaFX SDK versions, so we can help you.

    – José Pereda
    Jan 1 at 12:48













  • Okay. So i have a question. I'm now able to run JavaFX on windows. You know problem was with the JavaFX jar renaming!!. Actually I was building my project on linux and i see that there were 2 jars of each category. one is javafx-base-11.jar and another one javafx-base-11-linux.jar . When i copied these jars to my classpath in windows it was not taking these jars. So i tried to build my project in windows and there i found jars appended with -winn.jar. So my doubt is how it is like that/ These jars are completely different? If i rename -linux with -win it will not work.

    – anupm
    Jan 2 at 9:35













  • Each platform has different jars, with the proper native libraries (.so for linux, .dll for windows), so you can't use one jar on a different platform. You have to use a different JavaFX SDK and you have to distribute a different solution for each platform. See openjfx.io/openjfx-docs

    – José Pereda
    Jan 2 at 9:41











  • So you are telling that javaFX jars are now platform dependent? Then how we will achieve platform independent?? If i build my application in windows then I cannot run it on linux and vice-versa. Isn't it bad? I compared 2 jars (javafx-graphics-11-win.jar and javafx-graphics-11-linux.jar) files and found that these 2 are different. Is there any other approach to use graphics jar from other 3rd party libraries?

    – anupm
    Jan 2 at 11:41











  • Exactly, JavaFX jars are platform dependent, because some of them bundle native libraries for the given platform, like javafx-graphics-11-<platform>.jar. You can do distribution for each platform (via jlink or jpackage), at the end you rely on a VM that is specific of that platform. However, you can still do a fat jar bundling all the jars and native libraries into one. See openjfx.io/openjfx-docs/#modular (section non-modular project).

    – José Pereda
    Jan 2 at 13:28














2












2








2








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)









share|improve this question
















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)






windows-10 runtimeexception java-11 javafx-11






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 9:25









Dominique

2,08741941




2,08741941










asked Jan 1 at 9:52









anupmanupm

114




114













  • Edit your question and post how you run your app, your command line options, and your JDK/JavaFX SDK versions, so we can help you.

    – José Pereda
    Jan 1 at 12:48













  • Okay. So i have a question. I'm now able to run JavaFX on windows. You know problem was with the JavaFX jar renaming!!. Actually I was building my project on linux and i see that there were 2 jars of each category. one is javafx-base-11.jar and another one javafx-base-11-linux.jar . When i copied these jars to my classpath in windows it was not taking these jars. So i tried to build my project in windows and there i found jars appended with -winn.jar. So my doubt is how it is like that/ These jars are completely different? If i rename -linux with -win it will not work.

    – anupm
    Jan 2 at 9:35













  • Each platform has different jars, with the proper native libraries (.so for linux, .dll for windows), so you can't use one jar on a different platform. You have to use a different JavaFX SDK and you have to distribute a different solution for each platform. See openjfx.io/openjfx-docs

    – José Pereda
    Jan 2 at 9:41











  • So you are telling that javaFX jars are now platform dependent? Then how we will achieve platform independent?? If i build my application in windows then I cannot run it on linux and vice-versa. Isn't it bad? I compared 2 jars (javafx-graphics-11-win.jar and javafx-graphics-11-linux.jar) files and found that these 2 are different. Is there any other approach to use graphics jar from other 3rd party libraries?

    – anupm
    Jan 2 at 11:41











  • Exactly, JavaFX jars are platform dependent, because some of them bundle native libraries for the given platform, like javafx-graphics-11-<platform>.jar. You can do distribution for each platform (via jlink or jpackage), at the end you rely on a VM that is specific of that platform. However, you can still do a fat jar bundling all the jars and native libraries into one. See openjfx.io/openjfx-docs/#modular (section non-modular project).

    – José Pereda
    Jan 2 at 13:28



















  • Edit your question and post how you run your app, your command line options, and your JDK/JavaFX SDK versions, so we can help you.

    – José Pereda
    Jan 1 at 12:48













  • Okay. So i have a question. I'm now able to run JavaFX on windows. You know problem was with the JavaFX jar renaming!!. Actually I was building my project on linux and i see that there were 2 jars of each category. one is javafx-base-11.jar and another one javafx-base-11-linux.jar . When i copied these jars to my classpath in windows it was not taking these jars. So i tried to build my project in windows and there i found jars appended with -winn.jar. So my doubt is how it is like that/ These jars are completely different? If i rename -linux with -win it will not work.

    – anupm
    Jan 2 at 9:35













  • Each platform has different jars, with the proper native libraries (.so for linux, .dll for windows), so you can't use one jar on a different platform. You have to use a different JavaFX SDK and you have to distribute a different solution for each platform. See openjfx.io/openjfx-docs

    – José Pereda
    Jan 2 at 9:41











  • So you are telling that javaFX jars are now platform dependent? Then how we will achieve platform independent?? If i build my application in windows then I cannot run it on linux and vice-versa. Isn't it bad? I compared 2 jars (javafx-graphics-11-win.jar and javafx-graphics-11-linux.jar) files and found that these 2 are different. Is there any other approach to use graphics jar from other 3rd party libraries?

    – anupm
    Jan 2 at 11:41











  • Exactly, JavaFX jars are platform dependent, because some of them bundle native libraries for the given platform, like javafx-graphics-11-<platform>.jar. You can do distribution for each platform (via jlink or jpackage), at the end you rely on a VM that is specific of that platform. However, you can still do a fat jar bundling all the jars and native libraries into one. See openjfx.io/openjfx-docs/#modular (section non-modular project).

    – José Pereda
    Jan 2 at 13:28

















Edit your question and post how you run your app, your command line options, and your JDK/JavaFX SDK versions, so we can help you.

– José Pereda
Jan 1 at 12:48







Edit your question and post how you run your app, your command line options, and your JDK/JavaFX SDK versions, so we can help you.

– José Pereda
Jan 1 at 12:48















Okay. So i have a question. I'm now able to run JavaFX on windows. You know problem was with the JavaFX jar renaming!!. Actually I was building my project on linux and i see that there were 2 jars of each category. one is javafx-base-11.jar and another one javafx-base-11-linux.jar . When i copied these jars to my classpath in windows it was not taking these jars. So i tried to build my project in windows and there i found jars appended with -winn.jar. So my doubt is how it is like that/ These jars are completely different? If i rename -linux with -win it will not work.

– anupm
Jan 2 at 9:35







Okay. So i have a question. I'm now able to run JavaFX on windows. You know problem was with the JavaFX jar renaming!!. Actually I was building my project on linux and i see that there were 2 jars of each category. one is javafx-base-11.jar and another one javafx-base-11-linux.jar . When i copied these jars to my classpath in windows it was not taking these jars. So i tried to build my project in windows and there i found jars appended with -winn.jar. So my doubt is how it is like that/ These jars are completely different? If i rename -linux with -win it will not work.

– anupm
Jan 2 at 9:35















Each platform has different jars, with the proper native libraries (.so for linux, .dll for windows), so you can't use one jar on a different platform. You have to use a different JavaFX SDK and you have to distribute a different solution for each platform. See openjfx.io/openjfx-docs

– José Pereda
Jan 2 at 9:41





Each platform has different jars, with the proper native libraries (.so for linux, .dll for windows), so you can't use one jar on a different platform. You have to use a different JavaFX SDK and you have to distribute a different solution for each platform. See openjfx.io/openjfx-docs

– José Pereda
Jan 2 at 9:41













So you are telling that javaFX jars are now platform dependent? Then how we will achieve platform independent?? If i build my application in windows then I cannot run it on linux and vice-versa. Isn't it bad? I compared 2 jars (javafx-graphics-11-win.jar and javafx-graphics-11-linux.jar) files and found that these 2 are different. Is there any other approach to use graphics jar from other 3rd party libraries?

– anupm
Jan 2 at 11:41





So you are telling that javaFX jars are now platform dependent? Then how we will achieve platform independent?? If i build my application in windows then I cannot run it on linux and vice-versa. Isn't it bad? I compared 2 jars (javafx-graphics-11-win.jar and javafx-graphics-11-linux.jar) files and found that these 2 are different. Is there any other approach to use graphics jar from other 3rd party libraries?

– anupm
Jan 2 at 11:41













Exactly, JavaFX jars are platform dependent, because some of them bundle native libraries for the given platform, like javafx-graphics-11-<platform>.jar. You can do distribution for each platform (via jlink or jpackage), at the end you rely on a VM that is specific of that platform. However, you can still do a fat jar bundling all the jars and native libraries into one. See openjfx.io/openjfx-docs/#modular (section non-modular project).

– José Pereda
Jan 2 at 13:28





Exactly, JavaFX jars are platform dependent, because some of them bundle native libraries for the given platform, like javafx-graphics-11-<platform>.jar. You can do distribution for each platform (via jlink or jpackage), at the end you rely on a VM that is specific of that platform. However, you can still do a fat jar bundling all the jars and native libraries into one. See openjfx.io/openjfx-docs/#modular (section non-modular project).

– José Pereda
Jan 2 at 13:28












1 Answer
1






active

oldest

votes


















0














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
.






share|improve this answer
























  • My application runs on ubuntu 18 with no error. I have all javafx*.jar files in my classpath. If it runs on ubuntu with same configuration why not here? Do i have to do extra configuration for windows? I downloaded JavaFX sdk using the link you provided above. Could you please tell me how to configure this path?

    – anupm
    Jan 2 at 6:18











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53994490%2fgetting-java-lang-runtimeexception-no-toolkit-found-error-on-running-javafx-a%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














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
.






share|improve this answer
























  • My application runs on ubuntu 18 with no error. I have all javafx*.jar files in my classpath. If it runs on ubuntu with same configuration why not here? Do i have to do extra configuration for windows? I downloaded JavaFX sdk using the link you provided above. Could you please tell me how to configure this path?

    – anupm
    Jan 2 at 6:18
















0














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
.






share|improve this answer
























  • My application runs on ubuntu 18 with no error. I have all javafx*.jar files in my classpath. If it runs on ubuntu with same configuration why not here? Do i have to do extra configuration for windows? I downloaded JavaFX sdk using the link you provided above. Could you please tell me how to configure this path?

    – anupm
    Jan 2 at 6:18














0












0








0







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
.






share|improve this answer













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
.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 1 at 10:26









jsosnowskijsosnowski

89911341




89911341













  • My application runs on ubuntu 18 with no error. I have all javafx*.jar files in my classpath. If it runs on ubuntu with same configuration why not here? Do i have to do extra configuration for windows? I downloaded JavaFX sdk using the link you provided above. Could you please tell me how to configure this path?

    – anupm
    Jan 2 at 6:18



















  • My application runs on ubuntu 18 with no error. I have all javafx*.jar files in my classpath. If it runs on ubuntu with same configuration why not here? Do i have to do extra configuration for windows? I downloaded JavaFX sdk using the link you provided above. Could you please tell me how to configure this path?

    – anupm
    Jan 2 at 6:18

















My application runs on ubuntu 18 with no error. I have all javafx*.jar files in my classpath. If it runs on ubuntu with same configuration why not here? Do i have to do extra configuration for windows? I downloaded JavaFX sdk using the link you provided above. Could you please tell me how to configure this path?

– anupm
Jan 2 at 6:18





My application runs on ubuntu 18 with no error. I have all javafx*.jar files in my classpath. If it runs on ubuntu with same configuration why not here? Do i have to do extra configuration for windows? I downloaded JavaFX sdk using the link you provided above. Could you please tell me how to configure this path?

– anupm
Jan 2 at 6:18




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53994490%2fgetting-java-lang-runtimeexception-no-toolkit-found-error-on-running-javafx-a%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

SQL update select statement

WPF add header to Image with URL pettitions [duplicate]