0

I would like to deploy a java (or javafx program) which is usable even on a system that doesn't have JRE.

This question has been asked and answered:

But those 2 questions are over 10 years old, and I'm wondering if there are any new/better options as of 2022.

  • java has no native implementation for compiling as executable on any system. you should try .NET which support bytecode compilation – Volzy May 05 '22 at 12:56
  • Yes, since Java 9, you can build installers with no 3rd party tools: https://technojeeves.com/index.php/aliasjava1/111-making-native-installable-apps-with-java-9. Just to clarify, this does *not* compile to a native executable, but simply ports an installer with dedicated vm packaged as part of the installed app. It's no longer possible to make native binaries from Java. It *was* briefly, as part of the Gnu Classpath project, but that's gone now – g00se May 05 '22 at 12:56

2 Answers2

0

There are some options you could choose from:

  1. Bundle your JRE in your package

Eclipse does this for example. The put a JRE in the downloaded ZIP-File

  1. The rise of the native images

Some projects start to do native java-executables. One is Quarkus. But the don't support JavaFx. Base technology for that is GraalVM

Spring is also starting native images: Spring-Native

Here is an example of a java-fx native image: Java-FX Native Demo

Philipp Schneider
  • 352
  • 1
  • 4
  • 12
0

The tools to compile a JavaFX program into a native exectable can be found here: https://github.com/gluonhq/gluonfx-maven-plugin

Depending on your needs it might be also interesting though to just package your program for each platform via jpackage. Maybe following this tutorial https://github.com/dlemmermann/JPackageScriptFX

mipa
  • 10,369
  • 2
  • 16
  • 35