Getting error while creating JavaFX11 application

2020-03-24 05:53发布

问题:

i am new to java fx and i have downloaded Apache Netbeans 9 which runs on java 11.

since java fx is shipped separately, i have downloaded openjfx-11.0.1_SDK and followed steps in this link https://openjfx.io/openjfx-docs/#install-javafx

when i try to create java fx application in apache netbeans , i am getting below error

Failed to automatically set-up a JavaFX Platform. Please go to Platform Manager, create a non-default Java SE platform, then go to the JavaFX tab, enable JavaFX and fill in the paths to valid JavaFX SDK and JavaFX Runtime. Note: JavaFX SDK can be downloaded from JavaFX website

attaching screen shot of netbeans 10.

回答1:

Setting up the correct Environment For creating JavaFX11 application in Apache Netbeans 10 is Quite A Hustle .... This Link Might Help You in some extent

But even after completing these steps you will find even more Errors while running the project... Here is the Possible solution for that scenario



回答2:

I had the same issue on Netbeans 11. I solved this issue by following below steps.

  1. Download the javafx.zip file from the website and after downloading it put it on JDK folder.

  2. First, click on Manage Platforms and then click on Add platform and after clicking on Add platform it will ask of the filename, so give the path till JDK folder.

  3. After giving path click on next and it will ask for platform name and platform sources so in platform sources give the path till src.zip (jdk/lib/src.zip) and press finish button.

  4. After finishing button, you will see the new platform is added with the same name you have given platform name then click on it and go-to sources and click on Add Jar/Folder button and give the path till javafx.zip file which is saved on JDK folder.

  5. After giving path click on add Jar/folder and close it. After closing it click on JavaFX platform and in that you will see the platform name is there click on it and create the project.



回答3:

This is for the future developers that will stumble on this problem. You can follow this video for Installing JavaFX13 and integrate it with Apache Netbeans 11.2. Try following the instructions here

There might be problems with CSS autocomplete but you can create a JavaFx project now.

Edited: As suggested from the other answer, you can download the JavaFX from the official page of JavaFX.