How to get JavaFX and Java 11 working in IntelliJ IDEA











up vote
2
down vote

favorite
1












With the recent Java 11 release, JavaFX is no longer included in the JDK. I have an existing JavaFX project. I am interested in learning how to change it from a Java 10 project to a Java 11. I am certain I have installed Java 11 correctly, and I am able to change the default SDK from Java 10 to Java 11. What I don't know is how I might get JavaFX working with Java 11.



I have downloaded the latest JavaFX release here. I have extracted it to my Java folder which contains my other JDK's, but I really don't know what to do at this point. I have read some lengthy guides that describe how to connect a project using Maven or Gradle, but I have never used these. Is there a way to add JavaFX support in the IntelliJ menus?










share|improve this question


















  • 2




    Have you seen this question? It already provides an answer for a regular JavaFX project (without Maven/Gradle, but also with Maven). If you want a short guide, check this blog post.
    – José Pereda
    Oct 6 at 18:43






  • 2




    Possible duplicate of Intellij can't recognize javafx 11 with OpenJDK 11
    – nullpointer
    Oct 6 at 19:49















up vote
2
down vote

favorite
1












With the recent Java 11 release, JavaFX is no longer included in the JDK. I have an existing JavaFX project. I am interested in learning how to change it from a Java 10 project to a Java 11. I am certain I have installed Java 11 correctly, and I am able to change the default SDK from Java 10 to Java 11. What I don't know is how I might get JavaFX working with Java 11.



I have downloaded the latest JavaFX release here. I have extracted it to my Java folder which contains my other JDK's, but I really don't know what to do at this point. I have read some lengthy guides that describe how to connect a project using Maven or Gradle, but I have never used these. Is there a way to add JavaFX support in the IntelliJ menus?










share|improve this question


















  • 2




    Have you seen this question? It already provides an answer for a regular JavaFX project (without Maven/Gradle, but also with Maven). If you want a short guide, check this blog post.
    – José Pereda
    Oct 6 at 18:43






  • 2




    Possible duplicate of Intellij can't recognize javafx 11 with OpenJDK 11
    – nullpointer
    Oct 6 at 19:49













up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





With the recent Java 11 release, JavaFX is no longer included in the JDK. I have an existing JavaFX project. I am interested in learning how to change it from a Java 10 project to a Java 11. I am certain I have installed Java 11 correctly, and I am able to change the default SDK from Java 10 to Java 11. What I don't know is how I might get JavaFX working with Java 11.



I have downloaded the latest JavaFX release here. I have extracted it to my Java folder which contains my other JDK's, but I really don't know what to do at this point. I have read some lengthy guides that describe how to connect a project using Maven or Gradle, but I have never used these. Is there a way to add JavaFX support in the IntelliJ menus?










share|improve this question













With the recent Java 11 release, JavaFX is no longer included in the JDK. I have an existing JavaFX project. I am interested in learning how to change it from a Java 10 project to a Java 11. I am certain I have installed Java 11 correctly, and I am able to change the default SDK from Java 10 to Java 11. What I don't know is how I might get JavaFX working with Java 11.



I have downloaded the latest JavaFX release here. I have extracted it to my Java folder which contains my other JDK's, but I really don't know what to do at this point. I have read some lengthy guides that describe how to connect a project using Maven or Gradle, but I have never used these. Is there a way to add JavaFX support in the IntelliJ menus?







intellij-idea javafx installation gluon java-11






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 6 at 18:36









Jack J

106313




106313








  • 2




    Have you seen this question? It already provides an answer for a regular JavaFX project (without Maven/Gradle, but also with Maven). If you want a short guide, check this blog post.
    – José Pereda
    Oct 6 at 18:43






  • 2




    Possible duplicate of Intellij can't recognize javafx 11 with OpenJDK 11
    – nullpointer
    Oct 6 at 19:49














  • 2




    Have you seen this question? It already provides an answer for a regular JavaFX project (without Maven/Gradle, but also with Maven). If you want a short guide, check this blog post.
    – José Pereda
    Oct 6 at 18:43






  • 2




    Possible duplicate of Intellij can't recognize javafx 11 with OpenJDK 11
    – nullpointer
    Oct 6 at 19:49








2




2




Have you seen this question? It already provides an answer for a regular JavaFX project (without Maven/Gradle, but also with Maven). If you want a short guide, check this blog post.
– José Pereda
Oct 6 at 18:43




Have you seen this question? It already provides an answer for a regular JavaFX project (without Maven/Gradle, but also with Maven). If you want a short guide, check this blog post.
– José Pereda
Oct 6 at 18:43




2




2




Possible duplicate of Intellij can't recognize javafx 11 with OpenJDK 11
– nullpointer
Oct 6 at 19:49




Possible duplicate of Intellij can't recognize javafx 11 with OpenJDK 11
– nullpointer
Oct 6 at 19:49












1 Answer
1






active

oldest

votes

















up vote
-1
down vote













Download the appropriate JavaFX SDK for your operating system and unzip it to a desired location, for instance /Users/your-user/Downloads/javafx-sdk-11.




  1. Create a JavaFX project


enter image description here



Create a JavaFX project Provide a name to the project, like HelloFX, and a location. When the project opens, the JavaFX classes are not recognized.
enter image description here




  1. Set JDK 11


Go to File -> Project Structure -> Project, and set the project SDK to 11. You can also set the language level to 11. Set JDK 11
enter image description here




  1. Create a library


Go to File -> Project Structure -> Libraries and add the JavaFX 11 SDK as a library to the project. Point to the lib folder of the JavaFX SDK.
enter image description here



Once the library is applied, the JavaFX classes will be recognized by the IDE.
enter image description here



Warning: If you run now the project it will compile but you will get this error:




Error: JavaFX runtime components are missing, and are required to run
this application




This error is shown since the Java 11 launcher checks if the main class extends javafx.application.Application. If that is the case, it is required to have the javafx.graphics module on the module-path.




  1. Add VM options


To solve the issue, click on Run -> Edit Configurations... and add these VM options:




--module-path %PATH_TO_FX% --add-modules=javafx.controls,javafx.fxml




Note that the default project created by IntelliJ uses FXML, so javafx.fxml is required along with javafx.controls. If your project uses other modules, you will need to add them as well.
enter image description here
Click apply and close the dialog.




  1. Run the project


Click Run -> Run... to run the project, now it should work fine.






share|improve this answer

















  • 4




    At least you could add the link from where this is copied verbatim from.
    – José Pereda
    Nov 20 at 8:20











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',
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%2f52682195%2fhow-to-get-javafx-and-java-11-working-in-intellij-idea%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








up vote
-1
down vote













Download the appropriate JavaFX SDK for your operating system and unzip it to a desired location, for instance /Users/your-user/Downloads/javafx-sdk-11.




  1. Create a JavaFX project


enter image description here



Create a JavaFX project Provide a name to the project, like HelloFX, and a location. When the project opens, the JavaFX classes are not recognized.
enter image description here




  1. Set JDK 11


Go to File -> Project Structure -> Project, and set the project SDK to 11. You can also set the language level to 11. Set JDK 11
enter image description here




  1. Create a library


Go to File -> Project Structure -> Libraries and add the JavaFX 11 SDK as a library to the project. Point to the lib folder of the JavaFX SDK.
enter image description here



Once the library is applied, the JavaFX classes will be recognized by the IDE.
enter image description here



Warning: If you run now the project it will compile but you will get this error:




Error: JavaFX runtime components are missing, and are required to run
this application




This error is shown since the Java 11 launcher checks if the main class extends javafx.application.Application. If that is the case, it is required to have the javafx.graphics module on the module-path.




  1. Add VM options


To solve the issue, click on Run -> Edit Configurations... and add these VM options:




--module-path %PATH_TO_FX% --add-modules=javafx.controls,javafx.fxml




Note that the default project created by IntelliJ uses FXML, so javafx.fxml is required along with javafx.controls. If your project uses other modules, you will need to add them as well.
enter image description here
Click apply and close the dialog.




  1. Run the project


Click Run -> Run... to run the project, now it should work fine.






share|improve this answer

















  • 4




    At least you could add the link from where this is copied verbatim from.
    – José Pereda
    Nov 20 at 8:20















up vote
-1
down vote













Download the appropriate JavaFX SDK for your operating system and unzip it to a desired location, for instance /Users/your-user/Downloads/javafx-sdk-11.




  1. Create a JavaFX project


enter image description here



Create a JavaFX project Provide a name to the project, like HelloFX, and a location. When the project opens, the JavaFX classes are not recognized.
enter image description here




  1. Set JDK 11


Go to File -> Project Structure -> Project, and set the project SDK to 11. You can also set the language level to 11. Set JDK 11
enter image description here




  1. Create a library


Go to File -> Project Structure -> Libraries and add the JavaFX 11 SDK as a library to the project. Point to the lib folder of the JavaFX SDK.
enter image description here



Once the library is applied, the JavaFX classes will be recognized by the IDE.
enter image description here



Warning: If you run now the project it will compile but you will get this error:




Error: JavaFX runtime components are missing, and are required to run
this application




This error is shown since the Java 11 launcher checks if the main class extends javafx.application.Application. If that is the case, it is required to have the javafx.graphics module on the module-path.




  1. Add VM options


To solve the issue, click on Run -> Edit Configurations... and add these VM options:




--module-path %PATH_TO_FX% --add-modules=javafx.controls,javafx.fxml




Note that the default project created by IntelliJ uses FXML, so javafx.fxml is required along with javafx.controls. If your project uses other modules, you will need to add them as well.
enter image description here
Click apply and close the dialog.




  1. Run the project


Click Run -> Run... to run the project, now it should work fine.






share|improve this answer

















  • 4




    At least you could add the link from where this is copied verbatim from.
    – José Pereda
    Nov 20 at 8:20













up vote
-1
down vote










up vote
-1
down vote









Download the appropriate JavaFX SDK for your operating system and unzip it to a desired location, for instance /Users/your-user/Downloads/javafx-sdk-11.




  1. Create a JavaFX project


enter image description here



Create a JavaFX project Provide a name to the project, like HelloFX, and a location. When the project opens, the JavaFX classes are not recognized.
enter image description here




  1. Set JDK 11


Go to File -> Project Structure -> Project, and set the project SDK to 11. You can also set the language level to 11. Set JDK 11
enter image description here




  1. Create a library


Go to File -> Project Structure -> Libraries and add the JavaFX 11 SDK as a library to the project. Point to the lib folder of the JavaFX SDK.
enter image description here



Once the library is applied, the JavaFX classes will be recognized by the IDE.
enter image description here



Warning: If you run now the project it will compile but you will get this error:




Error: JavaFX runtime components are missing, and are required to run
this application




This error is shown since the Java 11 launcher checks if the main class extends javafx.application.Application. If that is the case, it is required to have the javafx.graphics module on the module-path.




  1. Add VM options


To solve the issue, click on Run -> Edit Configurations... and add these VM options:




--module-path %PATH_TO_FX% --add-modules=javafx.controls,javafx.fxml




Note that the default project created by IntelliJ uses FXML, so javafx.fxml is required along with javafx.controls. If your project uses other modules, you will need to add them as well.
enter image description here
Click apply and close the dialog.




  1. Run the project


Click Run -> Run... to run the project, now it should work fine.






share|improve this answer












Download the appropriate JavaFX SDK for your operating system and unzip it to a desired location, for instance /Users/your-user/Downloads/javafx-sdk-11.




  1. Create a JavaFX project


enter image description here



Create a JavaFX project Provide a name to the project, like HelloFX, and a location. When the project opens, the JavaFX classes are not recognized.
enter image description here




  1. Set JDK 11


Go to File -> Project Structure -> Project, and set the project SDK to 11. You can also set the language level to 11. Set JDK 11
enter image description here




  1. Create a library


Go to File -> Project Structure -> Libraries and add the JavaFX 11 SDK as a library to the project. Point to the lib folder of the JavaFX SDK.
enter image description here



Once the library is applied, the JavaFX classes will be recognized by the IDE.
enter image description here



Warning: If you run now the project it will compile but you will get this error:




Error: JavaFX runtime components are missing, and are required to run
this application




This error is shown since the Java 11 launcher checks if the main class extends javafx.application.Application. If that is the case, it is required to have the javafx.graphics module on the module-path.




  1. Add VM options


To solve the issue, click on Run -> Edit Configurations... and add these VM options:




--module-path %PATH_TO_FX% --add-modules=javafx.controls,javafx.fxml




Note that the default project created by IntelliJ uses FXML, so javafx.fxml is required along with javafx.controls. If your project uses other modules, you will need to add them as well.
enter image description here
Click apply and close the dialog.




  1. Run the project


Click Run -> Run... to run the project, now it should work fine.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 at 7:50









liuyez123

93




93








  • 4




    At least you could add the link from where this is copied verbatim from.
    – José Pereda
    Nov 20 at 8:20














  • 4




    At least you could add the link from where this is copied verbatim from.
    – José Pereda
    Nov 20 at 8:20








4




4




At least you could add the link from where this is copied verbatim from.
– José Pereda
Nov 20 at 8:20




At least you could add the link from where this is copied verbatim from.
– José Pereda
Nov 20 at 8:20


















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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f52682195%2fhow-to-get-javafx-and-java-11-working-in-intellij-idea%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

404 Error Contact Form 7 ajax form submitting

How to resolve this name issue having white space while installing the android Studio.?

C# WPF - Problem with Material Design Textbox