1

I am trying to create a JavaFX application using Netbeans IDE. Whenever I try to create one, the IDE says "Your JDK version does not support JavaFX." although the JDK is updated.

I'm really confused about how this will work.

I've been practicing and creating JavaFX applications on an online compiler since I was unable to run JavaFX on my Windows computer.

Now that I'm getting serious and want to create a good project using JavaFX, I want to use my go-to IDE, Netbeans. I've been experiencing a lot of problems.

Went to my professor about this, and he told me that there was some kind of fallout between Oracle and OpenJFX and they have pulled off the support of JavaFX from the latest versions of JDK. That confused me even further.

I've been browsing the internet for quite some time and came across the notion of OpenJDK and I kinda get the point but I don't know how to work with it.

I'm hoping to get an explanation of what all this mess is and how I can work it out and create my JavaFX project.

  • 3
    It's not clear what actual issue you're having, or what does/doesn't work. It's a library; you can download the JavaFX SDK or use Maven/Gradle. https://openjfx.io/openjfx-docs/#introduction – Dave Newton Dec 26 '22 at 19:31
  • I downloaded the javafx library and imported it into the project as a new library as specified on the openjfx.io website. But it still isn't working. – Shreyansh Tiwari Dec 26 '22 at 19:40
  • I haven't used NetBeans in many years, but my impression was that it was always the weakest of the "big three" (i.e., IntelliJ, Eclipse, NetBeans). You might have better luck using one of the other two IDEs (my personal preference is IntelliJ). You can also try to make use of an OpenJDK distribution from a vendor that includes JavaFX. See [BellSoft Liberica](https://bell-sw.com/pages/downloads/#/java-19-current) ("Full JDK" package) and/or [Azul Zulu](https://www.azul.com/downloads/?version=java-19-sts&package=jdk-fx) ("JDK FX" package). – Slaw Dec 26 '22 at 19:45
  • not sure if that note is your issue or not "Warning: Don't try to create a JavaFX project. The JavaFX Ant tasks of the current Apache NetBeans version are not ready for JavaFX 11+ yet, unless you have a custom JDK that bundles JavaFX, as described in Custom JDK+JavaFX image. " so i would recomend to walk step by step with the link that Dave mentioned –  Dec 26 '22 at 19:46
  • 2
    Regarding "_...some kind of fallout between Oracle and OpenJFX and they have pulled off the support..._" -- That sounds like a dramatization, but I suppose is technically true. JavaFX was never part of JavaSE, but Oracle included JavaFX in their distribution for a while anyway (at least for Java 8-10, maybe also Java 7, and never for the Linux distributions). For justifiable technical reasons, though possibly also for political reasons, they stopped including JavaFX as of Java 11. But JavaFX is still actively developed and can be added to your project like any other library. – Slaw Dec 26 '22 at 19:49
  • Thanks a lot @Slaw this makes sense to me now... I've been using Netbeans since I started dev in Java and have been using it ever since. I have no idea about Eclipse or IntelliJ. Would you suggest me to switch? Just wanna know how IntelliJ is better. – Shreyansh Tiwari Dec 26 '22 at 19:53
  • I personally can't point to any one thing that makes IntelliJ "better", and I say that only as an opinion. I started with NetBeans when I was first learning, because that's what all the tutorials that I looked at were using. Then I tried Eclipse for a while. But when I tried IntelliJ it just "felt" like an overall better experience. Though as I also haven't used Eclipse in quite a while, I don't have a feature-by-feature comparison I can give. However, I would suggest using Eclipse or IntelliJ over NetBeans. I also suggest you consider using a build tool (Maven or Gradle). – Slaw Dec 26 '22 at 20:06
  • Gotcha. I figure I still have got a lot to learn even though I've been coding in Java for a good 3-4 years. I still have no idea about what build tools are. Can you refer me somewhere where I can learn more about them? – Shreyansh Tiwari Dec 26 '22 at 20:10
  • 3
    That said, regardless of if you use IntelliJ, Eclipse, or NetBeans (or VS Code) and if you use Maven, Gradle, or no build tool, the link provided by Dave ([Getting Started with JavaFX 11+](https://openjfx.io/openjfx-docs/#introduction)) should be able to get you started with JavaFX. – Slaw Dec 26 '22 at 20:10
  • 3
    "_Can you refer me somewhere where I can learn more about them?_" -- First place is to start with their own websites: [Maven Getting Started Guide](https://maven.apache.org/guides/getting-started/index.html) and [Gradle User Manual](https://docs.gradle.org/current/userguide/userguide.html). Otherwise, just search for tutorials (articles and/or videos) or Google specific questions. – Slaw Dec 26 '22 at 20:15
  • 2
    By the way, you can quickly and easily create a new JavaFX app in IntelliJ. See [my Answer](https://stackoverflow.com/a/74764297/642706) to another Question. And IntelliJ can download and install a JDK from your choice of several vendors. – Basil Bourque Dec 26 '22 at 20:50

1 Answers1

4

starting a javafx project with maven on netbeans ide

You can start either with fxml or pure java code on >> new project window >> java with maven >>FXML javaFX Maven Archetype or Simple javaFX Maven Archetype .

new project

Then select name and location. Then ,set 19 as value in javafx-version key and 0.0.8 in javafx-maven-plugin-version

maven

Maven will download dependencies and project template can be run locally javafx 19

Giovanni Contreras
  • 2,345
  • 1
  • 13
  • 22