简体   繁体   中英

Why can't I create a JavaFX FXML Project in Netbeans 12.2?

Edit: I'm leaving this question as-is because there may be others who are using the same tutorial and asking the same question I was. The question arose from a class project that's been specified. While a variety of the provided answers will work, the instructor provided the solution to make a Java Application and then create FXML files. This is also in @Sedrick 's link.

--- Original ---

I've done everything I can think of, but no matter what I do, I get the same error when trying to create a new JavaFX FXML Application in Netbeans 12.2 using the path:

New Project > Java with Ant > JavaFX > JavaFX FXML Application

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.

I've made new platforms, re-downloaded and reinstalled every piece from Netbeans itself to the JDK and SDK, and rebooted in between each step. No matter what I do, I get the same error. I'm using instructions from a video tutorial.

I can reproduce the error on both Mac OSX Big Sur and Windows 10. I've verified specifications and am using JDK11, though I've tried JDK15 just in case. I've created a custom library and added the JARs for JavaFX.

Why isn't this working?

Try it with Maven, instead of Ant.

The Maven projects are used more heavily, and Ant has been on the slide downward for some time. Feel free to file an issue for the Ant project, but if you're just trying to get going forward, try the Maven projects.

I don't know why, but the short answer is that it's just not possible to create JavaFXML Applications like this in Netbeans 12.2. It's possible that the video tutorials were made on Netbeans 8.x, when it was possible.

You can still create and open FXML files using Netbeans 12.2, you'll just have to create the file manually. Create a project using

New Project > Java with Ant > Java Application

Then create your FXML file:

Right Click on Source Packages > New > Empty FXML

Of course, organize how you see fit, but this is the basics.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM