Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaFx can't build with native-image #4172

Closed
Anivie opened this issue Jan 3, 2022 · 3 comments
Closed

JavaFx can't build with native-image #4172

Anivie opened this issue Jan 3, 2022 · 3 comments
Assignees

Comments

@Anivie
Copy link

Anivie commented Jan 3, 2022

I can build JavaFx application on jdk11 with graalvm,but then i build it with jdk17,i get an error at "complete" process:Fatal error:com.oracle.svm.core.util.VMError$HostedError: should not reach here
After reporting this error, he still output an exe file, it can be used normally on my local computer, but when others try to open this file, they will encounter various problems: white screen, fonts are not displayed.

This error will not appear on Jdk11 with graalvm.

Step to to reappear:

  1. install visual studio 2022(2019 will have this error too) and choose c++ desktop to install
  2. make jar file with gradle shadow plugins
  3. call D:\VisualStudio\VC\Auxiliary\Build\vcvars64.bat
  4. java -agentlib:native-image-agent=config-output-dir=.\native-image\ -jar my.jar
  5. copy "native-image" into the jar
  6. native-image --no-fallback -jar my.jar

My environment:

  • JDK major version: Jdk17.0.1
  • OS: Windows 7,10,11(all of them will have this error on jdk 17)
  • Architecture: AMD64

This is build error then it running on "complete" process

Fatal error:com.oracle.svm.core.util.VMError$HostedError: should not reach here
        at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:64)
        at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.makeShimDLL(JNIRegistrationSupport.java:256)
        at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.makeShimDLLs(JNIRegistrationSupport.java:230)
        at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.afterImageWrite(JNIRegistrationSupport.java:175)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$doRun$8(NativeImageGenerator.java:663)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:73)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:663)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599)
[maker:3544]      [total]: 117,305.90 ms,  5.53 GB

Printing build artifacts to: C:\Users\Administrator\Desktop\maker.build_artifacts.txt
Error: Image build request failed with exit status 1

It will have a exe file can work on my pc,but then it run on another pc:
cacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULLcacheDWRITE_MATRIXFields error: JNI exception or tmpClass == NULL

@kkriske
Copy link
Contributor

kkriske commented Jan 3, 2022

native-image does not support JavaFX out of the box.
JavaFX support is provided by Gluon, through the GluonFX maven plugin.

@Anivie
Copy link
Author

Anivie commented Jan 4, 2022

native-image does not support JavaFX out of the box. JavaFX support is provided by Gluon, through the GluonFX maven plugin.

I am using TornadoFx,so I can’t compile with gluon.Do you have the other way?

@kkriske
Copy link
Contributor

kkriske commented Jan 4, 2022

TornadoFX works with GluonFX: gluonhq/substrate#572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants