nadirhussainnn / Utilities

This repository contains small programs , hacks and trciks that are useful for developers
1 stars 0 forks source link

How to setup JavaFX app in IntelliJ IDEA? #29

Open nadirhussainnn opened 3 years ago

nadirhussainnn commented 3 years ago
  1. Download JavaFX SDK from Here
  2. Download JDK from Here
  3. Install IntelliJ from Here

-Create New Project: Select JavaFX, Select JDK or Download it image

Next and Finish

-Now Right click on your project, and Open Module Settings as

image

-Select Libraries, add new Module as image

-Click on Java then OpenFile Dialog will open. Now select the path to your JavaFX lib folder, in my case it is

image

And then apply image

Upto here, we have added JSDK, JavaFX SDK. But we need to add VM options. So goto Documentation here In Section 4 of this document, you will find ADD VM options

image

Copy this line from there as --module-path "\path\to\javafx-sdk-17\lib" --add-modules javafx.controls,javafx.fxml

Now in your IntelliJ project, Click Run and Edit Configurations as

image

Click Modify options image

Then Select Add VM options image

Paste the above copied line here in VM options image

Remember to paste path to your Javafx SDK in VM option as

--module-path "\path\to\javafx-sdk-17\lib" --add-modules javafx.controls,javafx.fxml

Should Become in my case --module-path "E:\Softwares\JavaFX\javafx-sdk-17.0.0.1\lib" --add-modules javafx.controls,javafx.fxml

So paste this line in VM options. No apply and you are ready to run your first JavaFX app in IntelliJ.