1

We built a Jar (java 8) that runs with the Proper JDK and JRE. But on the client PCs is no suitable OpenJRE and because of policy reasons they only use a openJRE8 without jfxrt.jar (which is annoying).

Bacause of that, we can not run the JFX Jar like regular. But we can ship it with a suitable openJRE that contains jfx.

But for comfort reasons: is it possible to build the Jar in a way, in which the javaFX library is included/built into the Jar so we don't have to ship the whole enviroment ?

Luxusproblem
  • 1,913
  • 11
  • 23
  • Would building a fat jar solve the problem? [Building a fat jar using Maven](https://stackoverflow.com/questions/16222748/building-a-fat-jar-using-maven) – ldz Dec 03 '19 at 19:46
  • @ldz sadly not. we aslo tried launch4j but thats the same thing. we need to ship the enviroment – Luxusproblem Dec 03 '19 at 20:34

2 Answers2

0

With OpenJDK13, it is possible to include openjfx via maven dependencies, and then build a fat jar that includes the javafx libraries. Sadly, openjdk is not available for Java8

AdminOfThis
  • 191
  • 3
  • 2
    OpenJDK is availiable for java 8. Since Java 11 Oracle decided to treat JavaFX like any other library, a seperate Module. That works. But in Java 8 it seems like JavaFX depends on the Runtime jfxrt.jar . There are in Fact possibilities to have a OpenJDK 8 with java fx. But we can not use it because of policy reasons. – Luxusproblem Dec 04 '19 at 21:54
0

You have three options to run a JavaFX (OpenJFX) app. You need to have OpenJFX libraries: (a) within your app, (b) on the user’s classpath, or (c) bundled with a JVM installed on user’s local machine.

  • Wrap a copy of the OpenJDX libraries within your app bundle. See tools such as jlink.
    • You would likely want to use the Java Platform Module System to include a slimmed-down JDK as well. This makes for a completely self-contained double-clickable app that can launch like a native app.
  • Put a copy of the OpenJFX libraries on the user's machine, on the Java classpath somewhere.
  • Install a JDK on the user’s machine that includes a copy of the OpenJFX libraries. I know of two Java implementations that include those libraries:
    • LibericaFX from BellSoft
    • ZuluFX from Azul Systems

Study:

Here is a flowchart to help choosing a Java implementation vendor. Notice the decision box at bottom for JavaFX/OpenJFX.

Flowchart guiding you in choosing a vendor for a Java 11 implementation

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154