running JavaFX application after jpackage

前端 未结 1 848
执笔经年
执笔经年 2020-12-12 05:30

I have some really noob question. I tried to create installation for my test app with jpackage in OpenJDK 14. Here is what I did:

first, created custom JRE with

相关标签:
1条回答
  • 2020-12-12 05:48

    The JavaFX JARs included with the JavaFX SDK do not include the native code. Instead, said code is in the bin directory. That means your custom runtime image created by jlink does not have the necessary native code to run JavaFX. You have two options:

    1. Download the JMOD files from Gluon and use those when creating the custom runtime image. You would put the JMOD files on the --module-path instead of the regular JAR files.

    2. Use the JavaFX JARs that are published to Maven Central instead of the SDK. The Maven Central JARs embed the native code.

    In both cases, make sure to use the JMOD/JAR files for your operating system—JavaFX is platform-specific.

    I believe the first option is the best. When using JMOD files with jlink the native code is included with the custom runtime image in the same way as the native code specific to the JRE. If you use the second approach the native code will still be included with the custom runtime image but it will have to be extracted to some location on your computer (e.g. <user-home>/.openjfx) before it can be used1. In other words, the first option is cleaner.


    1. Note this extraction is done automatically by JavaFX.

    0 讨论(0)
提交回复
热议问题