0

So, before upgrading to JDK 20, I was using JDK 1.8. In 1.8, Java programs could be packaged into native programs through the use of Java FX. Unfortunately, JDK 20 does not come bundled with JavaFX and so I had to download JavaFX 20 seperately.

I tried to add it into Netbeans, which is the IDE I'm using, but I really have no idea what I'm doing. I was wondering if someone could help me out with how I can add JavaFX 20 to Netbeans so I can use it to transform my Java programs into native programs. Also, is there an alternative to all this, a way to turn Java programs into native programs without the use of JavaFX at all?

  • 5
    Look into [jpackage](https://docs.oracle.com/en/java/javase/20/jpackage/packaging-overview.html#GUID-C1027043-587D-418D-8188-EF8F44A4C06A) or [GraalVM native image](https://www.graalvm.org/22.0/reference-manual/native-image/). If you're actually using JavaFX in your program, see [Getting Started with JavaFX 11+](https://openjfx.io/openjfx-docs/) (and consider using a JDK that includes JavaFX, such as BellSoft Liberica or Azul Zulu; also see https://bell-sw.com/announcements/2022/08/24/turning-javafx-apps-into-native-images/) – Slaw Jun 21 '23 at 10:25
  • What kind of native program? An [exe file](https://stackoverflow.com/questions/69811401/how-to-create-a-standalone-exe-in-java-that-runs-without-an-installer-and-a-jr)? – jewelsea Jun 22 '23 at 05:45
  • @jewelsea, yes, an exe file – Juancarlos Kai Shiro Jun 23 '23 at 09:50
  • @Slaw, I did check out javapackager and it seems to be the best option for working with JDK-20. Mind redirecting me to a tutorial on how to use it? I've tried searching around for some, but really the only useful stuff I've found is the Oracle documentation on it – Juancarlos Kai Shiro Jun 23 '23 at 09:53
  • Note `javapackager` was what `javafxpackager` was renamed to. That tool was deprecated and removed, then was eventually replaced with `jpackage` around Java 14-16. I don't have a go-to tutorial for `jpackage`, as I find the user guide (linked previously) to be sufficient. I recommend just trying to get a basic "hello world" application working by following the user guide. If you run into a specific problem then you can ask a specific question. Also, if your real program is non-trivial, I recommend using a build tool (Maven or Gradle); they typically have useful plugins for stuff like this. – Slaw Jun 23 '23 at 11:10

0 Answers0