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

[native-image] Native image of JavaFX application can not run #403

Open
Glavo opened this issue May 4, 2018 · 112 comments
Open

[native-image] Native image of JavaFX application can not run #403

Glavo opened this issue May 4, 2018 · 112 comments
Assignees

Comments

@Glavo
Copy link

Glavo commented May 4, 2018

I'm trying to use GraalVM EE and GraalVM CE with OpenJFX installed to generate a native image for ClassViewer, but they could not operate properly for different reasons

GraalVM CE with OpenJDK:

glavo@glavo:~/下载$ ./graalvm-1.0.0-rc1/bin/native-image -jar ClassViewer-3.2.jar 
Warning: Native image server limit exceeded. Use options --server{-list,-shutdown[-all]} to fix the problem.
   classlist:   1,028.48 ms
       (cap):   1,500.51 ms
       setup:   2,462.52 ms
[INFO] Load recent files from file: /home/glavo/.viewer/recentfiles
Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
	at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
	at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:221)
	at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:248)
	at javafx.scene.image.Image.loadImage(Image.java:1065)
	at javafx.scene.image.Image.initialize(Image.java:807)
	at javafx.scene.image.Image.<init>(Image.java:621)
	at org.glavo.viewer.util.ImageUtils.loadImage(ImageUtils.java:19)
	at org.glavo.viewer.util.ImageUtils.<clinit>(ImageUtils.java:30)
	at org.glavo.viewer.gui.filetypes.classfile.ClassFileType.<init>(ClassFileType.java:24)
	at org.glavo.viewer.gui.filetypes.classfile.ClassFileType.<clinit>(ClassFileType.java:20)
	at org.glavo.viewer.gui.filetypes.FileType.<clinit>(FileType.java:17)
	at org.glavo.viewer.gui.RecentFile.parse(RecentFile.java:14)
	at org.glavo.viewer.gui.RecentFiles.lambda$load$1(RecentFiles.java:127)
	at java.util.Iterator.forEachRemaining(Iterator.java:116)
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
	at org.glavo.viewer.gui.RecentFiles.load(RecentFiles.java:124)
	at org.glavo.viewer.gui.RecentFiles.<init>(RecentFiles.java:28)
	at org.glavo.viewer.gui.RecentFiles.<clinit>(RecentFiles.java:19)
	at sun.misc.Unsafe.ensureClassInitialized(Native Method)
	at jdk.vm.ci.hotspot.HotSpotConstantPool.loadReferencedType(HotSpotConstantPool.java:695)
	at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.loadReferencedType(WrappedConstantPool.java:58)
	at org.graalvm.compiler.java.BytecodeParser.maybeEagerlyResolve(BytecodeParser.java:3847)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.maybeEagerlyResolve(SharedGraphBuilderPhase.java:102)
	at org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:3801)
	at org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1380)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.genInvokeStatic(SharedGraphBuilderPhase.java:171)
	at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:4677)
	at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3065)
	at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:2886)
	at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:880)
	at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:774)
	at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:93)
	at org.graalvm.compiler.phases.Phase.run(Phase.java:47)
	at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:195)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:40)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:36)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:195)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:319)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:308)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:298)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:105)
	at com.oracle.graal.pointsto.flow.StaticInvokeTypeFlow.update(InvokeTypeFlow.java:344)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:498)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:172)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
	at java.lang.Thread.run(Thread.java:748)
Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
	at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
	at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:221)
	at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:248)
	at javafx.stage.Screen.<clinit>(Screen.java:79)
	at sun.misc.Unsafe.ensureClassInitialized(Native Method)
	at jdk.vm.ci.hotspot.HotSpotConstantPool.loadReferencedType(HotSpotConstantPool.java:695)
	at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.loadReferencedType(WrappedConstantPool.java:58)
	at org.graalvm.compiler.java.BytecodeParser.maybeEagerlyResolve(BytecodeParser.java:3847)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.maybeEagerlyResolve(SharedGraphBuilderPhase.java:102)
	at org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:3801)
	at org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1380)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.genInvokeStatic(SharedGraphBuilderPhase.java:171)
	at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:4677)
	at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3065)
	at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:2886)
	at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:880)
	at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:774)
	at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:93)
	at org.graalvm.compiler.phases.Phase.run(Phase.java:47)
	at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:195)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:40)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:36)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:195)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:319)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:308)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:298)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:105)
	at com.oracle.graal.pointsto.flow.SpecialInvokeTypeFlow.onObservedUpdate(InvokeTypeFlow.java:419)
	at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:345)
	at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:387)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:498)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:172)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
	at java.lang.Thread.run(Thread.java:748)

GraalVM EE:

glavo@glavo:~/下载/A$ ./graalvm-1.0.0-rc1/bin/native-image -jar ClassViewer-3.2.jar 
Warning: Native image server limit exceeded. Use options --server{-list,-shutdown[-all]} to fix the problem.
   classlist:   1,110.72 ms
       (cap):   2,017.22 ms
       setup:   3,309.41 ms
[INFO] Load recent files from file: /home/glavo/.viewer/recentfiles
    analysis:   7,225.19 ms
error: unsupported features in 7 methods
Detailed message:
Error: Error loading a referenced type: java.lang.IllegalStateException: This operation is permitted on the event thread only; currentThread = ForkJoinPool-3-worker-7
Trace: 
	at parsing javafx.stage.Window.<init>(Window.java:1209)
Call path from entry point to javafx.stage.Window.<init>(): 
	at javafx.stage.Window.<init>(Window.java:155)
	at javafx.stage.Stage.<init>(Stage.java:239)
	at javafx.stage.Stage.<init>(Stage.java:227)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:783)
	at com.sun.javafx.application.LauncherImpl$$Lambda$511/494541179.run(Unknown Source)
	at com.oracle.svm.core.JavaMainWrapper$JavaMainSupport.executeHooks(JavaMainWrapper.java:105)
	at com.oracle.svm.core.JavaMainWrapper$JavaMainSupport.executeStartupHooks(JavaMainWrapper.java:91)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:198)
	at Lcom/oracle/svm/core/code/CEntryPointCallStubs;.com_002eoracle_002esvm_002ecore_002eJavaMainWrapper_002erun_0028int_002corg_002egraalvm_002enativeimage_002ec_002etype_002eCCharPointerPointer_0029(generated:0)
Original exception that caused the problem: java.lang.IllegalStateException: This operation is permitted on the event thread only; currentThread = ForkJoinPool-3-worker-7
	at com.sun.glass.ui.Application.checkEventThread(Application.java:443)
	at com.sun.glass.ui.Screen.setEventHandler(Screen.java:285)
	at com.sun.javafx.tk.quantum.QuantumToolkit.setScreenConfigurationListener(QuantumToolkit.java:674)
	at javafx.stage.Screen.<clinit>(Screen.java:79)
	at sun.misc.Unsafe.ensureClassInitialized(Native Method)
	at jdk.vm.ci.hotspot.HotSpotConstantPool.loadReferencedType(HotSpotConstantPool.java:695)
	at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.loadReferencedType(WrappedConstantPool.java:58)
	at org.graalvm.compiler.java.BytecodeParser.maybeEagerlyResolve(BytecodeParser.java:3847)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.maybeEagerlyResolve(SharedGraphBuilderPhase.java:102)
	at org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:3801)
	at org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1380)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.genInvokeStatic(SharedGraphBuilderPhase.java:171)
	at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:4677)
	at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3065)
	at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:2886)
	at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:880)
	at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:774)
	at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:93)
	at org.graalvm.compiler.phases.Phase.run(Phase.java:47)
	at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:195)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:40)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:36)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:195)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:319)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:308)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:298)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:105)
	at com.oracle.graal.pointsto.flow.SpecialInvokeTypeFlow.onObservedUpdate(InvokeTypeFlow.java:419)
	at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:345)
	at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:387)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:498)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:172)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Error loading a referenced type: java.lang.NoClassDefFoundError: Could not initialize class javafx.stage.Screen
Trace: 
	at parsing com.sun.javafx.tk.quantum.QuantumToolkit.initSceneGraph(QuantumToolkit.java:298)
Call path from entry point to com.sun.javafx.tk.quantum.QuantumToolkit.initSceneGraph(): 
	at com.sun.javafx.tk.quantum.QuantumToolkit.initSceneGraph(QuantumToolkit.java:298)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:340)
	at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$402(QuantumToolkit.java:257)
	at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$538/1806242102.run(Unknown Source)
	at com.oracle.svm.core.JavaMainWrapper$JavaMainSupport.executeHooks(JavaMainWrapper.java:105)
	at com.oracle.svm.core.JavaMainWrapper$JavaMainSupport.executeStartupHooks(JavaMainWrapper.java:91)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:198)
	at Lcom/oracle/svm/core/code/CEntryPointCallStubs;.com_002eoracle_002esvm_002ecore_002eJavaMainWrapper_002erun_0028int_002corg_002egraalvm_002enativeimage_002ec_002etype_002eCCharPointerPointer_0029(generated:0)
Original exception that caused the problem: java.lang.NoClassDefFoundError: Could not initialize class javafx.stage.Screen
	at sun.misc.Unsafe.ensureClassInitialized(Native Method)
	at jdk.vm.ci.hotspot.HotSpotConstantPool.loadReferencedType(HotSpotConstantPool.java:695)
	at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.loadReferencedType(WrappedConstantPool.java:58)
	at org.graalvm.compiler.java.BytecodeParser.maybeEagerlyResolve(BytecodeParser.java:3847)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.maybeEagerlyResolve(SharedGraphBuilderPhase.java:102)
	at org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:3801)
	at org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1380)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.genInvokeStatic(SharedGraphBuilderPhase.java:171)
	at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:4677)
	at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3065)
	at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:2886)
	at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:880)
	at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:774)
	at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:93)
	at org.graalvm.compiler.phases.Phase.run(Phase.java:47)
	at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:195)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:40)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:36)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:195)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:319)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:308)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:298)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:105)
	at com.oracle.graal.pointsto.flow.StaticInvokeTypeFlow.update(InvokeTypeFlow.java:344)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:498)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:172)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Error loading a referenced type: java.lang.RuntimeException: Internal graphics not initialized yet
Trace: 
	at parsing org.glavo.viewer.gui.Options.init(Options.java:51)
Call path from entry point to org.glavo.viewer.gui.Options.init(): 
	at org.glavo.viewer.gui.Options.init(Options.java:25)
	at org.glavo.viewer.gui.Viewer.main(Viewer.java:28)
	at com.oracle.svm.reflect.proxies.Proxy_1_Viewer_main.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:199)
	at Lcom/oracle/svm/core/code/CEntryPointCallStubs;.com_002eoracle_002esvm_002ecore_002eJavaMainWrapper_002erun_0028int_002corg_002egraalvm_002enativeimage_002ec_002etype_002eCCharPointerPointer_0029(generated:0)
Original exception that caused the problem: java.lang.RuntimeException: Internal graphics not initialized yet
	at com.sun.glass.ui.Screen.getScreens(Screen.java:70)
	at com.sun.javafx.tk.quantum.QuantumToolkit.getScreens(QuantumToolkit.java:699)
	at com.sun.javafx.tk.quantum.QuantumToolkit.getMaxRenderScale(QuantumToolkit.java:719)
	at com.sun.javafx.tk.quantum.QuantumToolkit.loadImage(QuantumToolkit.java:727)
	at javafx.scene.image.Image.loadImage(Image.java:1065)
	at javafx.scene.image.Image.initialize(Image.java:807)
	at javafx.scene.image.Image.<init>(Image.java:621)
	at org.glavo.viewer.util.ImageUtils.loadImage(ImageUtils.java:19)
	at org.glavo.viewer.util.ImageUtils.<clinit>(ImageUtils.java:30)
	at org.glavo.viewer.gui.filetypes.classfile.ClassFileType.<init>(ClassFileType.java:24)
	at org.glavo.viewer.gui.filetypes.classfile.ClassFileType.<clinit>(ClassFileType.java:20)
	at org.glavo.viewer.gui.filetypes.FileType.<clinit>(FileType.java:17)
	at org.glavo.viewer.gui.RecentFile.parse(RecentFile.java:14)
	at org.glavo.viewer.gui.RecentFiles.lambda$load$1(RecentFiles.java:127)
	at java.util.Iterator.forEachRemaining(Iterator.java:116)
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
	at org.glavo.viewer.gui.RecentFiles.load(RecentFiles.java:124)
	at org.glavo.viewer.gui.RecentFiles.<init>(RecentFiles.java:28)
	at org.glavo.viewer.gui.RecentFiles.<clinit>(RecentFiles.java:19)
	at sun.misc.Unsafe.ensureClassInitialized(Native Method)
	at jdk.vm.ci.hotspot.HotSpotConstantPool.loadReferencedType(HotSpotConstantPool.java:695)
	at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.loadReferencedType(WrappedConstantPool.java:58)
	at org.graalvm.compiler.java.BytecodeParser.maybeEagerlyResolve(BytecodeParser.java:3847)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.maybeEagerlyResolve(SharedGraphBuilderPhase.java:102)
	at org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:3801)
	at org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1380)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.genInvokeStatic(SharedGraphBuilderPhase.java:171)
	at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:4677)
	at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3065)
	at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:2886)
	at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:880)
	at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:774)
	at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:93)
	at org.graalvm.compiler.phases.Phase.run(Phase.java:47)
	at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:195)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:40)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:36)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:195)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:319)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:308)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:298)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:105)
	at com.oracle.graal.pointsto.flow.StaticInvokeTypeFlow.update(InvokeTypeFlow.java:344)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:498)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:172)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Must not have a started Thread in the image heap.
Trace: 	object com.sun.javafx.tk.quantum.QuantumRenderer
	object java.util.concurrent.atomic.AtomicReference
	method com.sun.javafx.tk.quantum.QuantumRenderer.stopRenderer()
Call path from entry point to com.sun.javafx.tk.quantum.QuantumRenderer.stopRenderer(): 
	at com.sun.javafx.tk.quantum.QuantumRenderer.stopRenderer(QuantumRenderer.java:195)
	at com.sun.javafx.tk.quantum.QuantumToolkit.dispose(QuantumToolkit.java:781)
	at com.sun.javafx.tk.quantum.QuantumToolkit$1.run(QuantumToolkit.java:230)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:222)
	at Lcom/oracle/svm/core/code/CEntryPointCallStubs;.com_002eoracle_002esvm_002ecore_002eposix_002ethread_002ePosixJavaThreads_002epthreadStartRoutine_0028com_002eoracle_002esvm_002ecore_002eposix_002ethread_002ePosixJavaThreads_0024ThreadStartData_0029(generated:0)
Error: Must not have a started Thread in the image heap.
Trace: 	field com.sun.prism.es2.ES2Pipeline.creator
Error: Must not have a started Thread in the image heap.
Trace: 	object java.util.concurrent.ThreadPoolExecutor$Worker
	object java.util.HashMap$Node
	object java.util.HashMap$Node[]
	object java.util.HashMap
	object java.util.HashSet
	object com.sun.javafx.tk.quantum.QuantumRenderer
	object java.util.concurrent.atomic.AtomicReference
	method com.sun.javafx.tk.quantum.QuantumRenderer.stopRenderer()
Call path from entry point to com.sun.javafx.tk.quantum.QuantumRenderer.stopRenderer(): 
	at com.sun.javafx.tk.quantum.QuantumRenderer.stopRenderer(QuantumRenderer.java:195)
	at com.sun.javafx.tk.quantum.QuantumToolkit.dispose(QuantumToolkit.java:781)
	at com.sun.javafx.tk.quantum.QuantumToolkit$1.run(QuantumToolkit.java:230)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:222)
	at Lcom/oracle/svm/core/code/CEntryPointCallStubs;.com_002eoracle_002esvm_002ecore_002eposix_002ethread_002ePosixJavaThreads_002epthreadStartRoutine_0028com_002eoracle_002esvm_002ecore_002eposix_002ethread_002ePosixJavaThreads_0024ThreadStartData_0029(generated:0)
Error: Must not have a started Thread in the image heap.
Trace: 	object java.util.concurrent.locks.AbstractQueuedSynchronizer$Node
	object java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject
	object java.util.concurrent.LinkedBlockingQueue
	object com.sun.javafx.tk.quantum.QuantumRenderer
	object java.util.concurrent.atomic.AtomicReference
	method com.sun.javafx.tk.quantum.QuantumRenderer.stopRenderer()
Call path from entry point to com.sun.javafx.tk.quantum.QuantumRenderer.stopRenderer(): 
	at com.sun.javafx.tk.quantum.QuantumRenderer.stopRenderer(QuantumRenderer.java:195)
	at com.sun.javafx.tk.quantum.QuantumToolkit.dispose(QuantumToolkit.java:781)
	at com.sun.javafx.tk.quantum.QuantumToolkit$1.run(QuantumToolkit.java:230)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:222)
	at Lcom/oracle/svm/core/code/CEntryPointCallStubs;.com_002eoracle_002esvm_002ecore_002eposix_002ethread_002ePosixJavaThreads_002epthreadStartRoutine_0028com_002eoracle_002esvm_002ecore_002eposix_002ethread_002ePosixJavaThreads_0024ThreadStartData_0029(generated:0)

Error: Image building with exit status 1
@Glavo
Copy link
Author

Glavo commented May 4, 2018

It looks like this problem exists for all JavaFX apps GraalVM, when I tried to deal with this demo, they also failed for the same reason.

@cstancu
Copy link
Member

cstancu commented May 4, 2018

@Glavo thank you for your report. We haven't tried running JavaFX apps so far. We'll look into it.

@tisonkun
Copy link
Contributor

tisonkun commented May 4, 2018

For cross refer #358

@psini
Copy link

psini commented Jul 23, 2018

Any news?

3 similar comments
@alexandrenavarro
Copy link

Any news?

@ssmooncoder
Copy link

Any news?

@chengenzhao
Copy link

Any news?

@tsatatwer
Copy link

Any news please.

@chengenzhao
Copy link

Hi folks:

For JavaFX 11 , you probably don't need native image since you could use jlink to create your own customized runtime which is relatively small and JavaFX is distributed in jmods which can be used to create your own java runtime, so maybe keep a runtime is a better idea rather than compile the whole program into native:)

Hope it helps

@tsatatwer
Copy link

tsatatwer commented Nov 4, 2018

Compile the whole program into native in some situations protect the code speeds start up and running the program faster and reduce memory .

@Glavo
Copy link
Author

Glavo commented Nov 10, 2018

@chengenzhao The JavaFX application I am developing is for Java developers, so I don't need to use jlink to package the entire runtime environment. My goal is to reduce the memory consumption and reduce the startup time of the application through Graal. I have tried to compile my application to native using ExcelsiorJET, and ExcelsiorJET successfully reduced 90% of startup time and 50% of memory usage.

@cubuspl42
Copy link

Managed to make it build, but doesn't run properly: #994

@ssmooncoder
Copy link

Is this project dead? I guess React is the way to go for native ui...

@cubuspl42
Copy link

@ssmooncoder You must be confused, nobody ever suggested that GraalFX JavaFX (JavaFXPorts with iOS support, I assume?...) is a production-ready solution for developing mobile applications.

@thomaswue
Copy link
Member

@johanvos did some recent work in the area of supporting JavaFX via native images.

@tsatatwer
Copy link

tsatatwer commented May 22, 2019

@cstancu any news on the issue ???? more than ONE YEAR ???? you are looking since May 4, 2018 ??? so what now ???.

@chengenzhao
Copy link

https://gluonhq.com/a-boost-for-java-on-the-client/
beta version now
cheers

@tsatatwer
Copy link

tsatatwer commented May 30, 2019

@chengenzhao , thanks for the link BUT still only MAC NO windows yet.

@4ntoine
Copy link

4ntoine commented Jun 23, 2019

any update? 1.1 year passed

@johanvos
Copy link
Contributor

This is currently working on Mac, Linux and iOS. See https://github.com/gluonhq/client-samples (docs for Linux are not there yet).
We're working on Windows and Android now.

@4ntoine
Copy link

4ntoine commented Jun 24, 2019 via email

@nithyasharabheshwara
Copy link

This is currently working on Mac, Linux and iOS. See https://github.com/gluonhq/client-samples (docs for Linux are not there yet).
We're working on Windows and Android now.

Thank you, looking forward to it.

@4ntoine
Copy link

4ntoine commented Jul 6, 2019

Hey. I've just tried 19.1.0 with JavaFX app: https://github.com/4ntoine/NotesClientApp/

Getting the following exception:

$~/Documents/dev/src/graalvm-ce-19.1.0/Contents/Home/bin/native-image -cp /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/ -jar app-javafx-all.jar 
Build on Server(pid: 68849, port: 64448)
[app-javafx-all:68849]    classlist:     702.81 ms
Fatal error: java.lang.NoClassDefFoundError: javafx/application/Application
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:256)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:446)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.executeCompilation(NativeImageBuildServer.java:394)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.lambda$processCommand$8(NativeImageBuildServer.java:331)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.withJVMContext(NativeImageBuildServer.java:412)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.processCommand(NativeImageBuildServer.java:328)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.processRequest(NativeImageBuildServer.java:272)
	at com.oracle.svm.hosted.server.NativeImageBuildServer.lambda$serve$7(NativeImageBuildServer.java:232)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 24 more
Error: Image build request failed with exit status 1
~/Documents/dev/src/Notes/NotesClientApp/app-javafx/build/libs asmirnov$ls /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/
.                   cldrdata.jar        jaccess.jar         localedata.jar      nashorn.jar         sunjce_provider.jar zipfs.jar
..                  dnsns.jar           jfxrt.jar           meta-index          sunec.jar           sunpkcs11.jar

jfxrt.jar contains javafx.application.Application

Снимок экрана 2019-07-07 в 2 02 29

command-line seems to be correct: https://www.graalvm.org/docs/reference-manual/aot-compilation/

I can imagine some class that javafx.application.Application references can't be found..

What am i missing?

@4ntoine
Copy link

4ntoine commented Jul 6, 2019

Does it require JavaFX 12 min? https://github.com/gluonhq/client-samples/blob/master/Gradle/HelloFX/build.gradle

Currently i'm trying with JavaFX8.

@fujohnwang
Copy link

an issue stayed so long time ;)

@sgyeme
Copy link

sgyeme commented Apr 2, 2021

Any work around other than gloun. Because so many libraries cannot work with it.

@liudonghua123
Copy link

I have the same issue recently when I want to make a JavaFx app executable. After go through the code, I found it had more debugging info when add -Dprism.verbose=true.

Here are the steps when I tried to fix the native-image problems.

prism_d3d.dll is not in PATH.

D:\code\java\jfx-simple\shade>jfx -Dprism.verbose=true
Dec 03, 2021 9:52:42 AM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @37095ded'
Prism pipeline init order: d3d sw 
Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.d3d.D3DPipeline
Loading D3D native library ...
GraphicsPipeline.createPipeline failed for com.sun.prism.d3d.D3DPipeline
java.lang.UnsatisfiedLinkError: no prism_d3d in java.library.path
        at com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryRelative(NativeLibrarySupport.java:132) 
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:133)
        at java.lang.Runtime.loadLibrary0(Runtime.java:830)
        at java.lang.System.loadLibrary(System.java:1871)
        at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:166)
        at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:54)
        at com.sun.prism.d3d.D3DPipeline.lambda$static$0(D3DPipeline.java:54)
        at java.security.AccessController.doPrivileged(AccessController.java:87)
        at com.sun.prism.d3d.D3DPipeline.<clinit>(D3DPipeline.java:50)
        at java.lang.Class.ensureInitialized(DynamicHub.java:552)
        at java.lang.Class.forName(DynamicHub.java:1436)
        at java.lang.Class.forName(DynamicHub.java:1408)
        at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)        
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)        
        at java.lang.Thread.run(Thread.java:829)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
GraphicsPipeline.createPipeline failed for com.sun.prism.sw.SWPipeline
java.lang.ClassNotFoundException: com.sun.prism.sw.SWPipeline
        at java.lang.Class.forName(DynamicHub.java:1433)
        at java.lang.Class.forName(DynamicHub.java:1408)
        at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)        
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)        
        at java.lang.Thread.run(Thread.java:829)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
Graphics Device initialization failed for :  d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
        at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:254)
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:264)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
        at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:679)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)       
        at java.lang.Thread.run(Thread.java:829)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found      
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)        
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)        
        ... 3 more
Exception in thread "main" java.lang.RuntimeException: No toolkit found
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:276)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
        at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:679)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)       
        at java.lang.Thread.run(Thread.java:829)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)

D:\code\java\jfx-simple\shade>

com.sun.prism.impl.PrismSettings should config in jniconfig.json by -H:JNIConfigurationFiles.

D:\code\java\jfx-simple\shade>jfx -Dprism.verbose=true
Dec 03, 2021 9:53:38 AM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @37095ded'
Prism pipeline init order: d3d sw 
Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.d3d.D3DPipeline
Loading D3D native library ...
        succeeded.
GraphicsPipeline.createPipeline failed for com.sun.prism.d3d.D3DPipeline
java.lang.NoSuchFieldError: com.sun.prism.impl.PrismSettings.forceGPU
        at com.oracle.svm.jni.functions.JNIFunctions$Support.getFieldID(JNIFunctions.java:1126)
        at com.oracle.svm.jni.functions.JNIFunctions.GetStaticFieldID(JNIFunctions.java:434)
        at com.sun.prism.d3d.D3DPipeline.nInit(D3DPipeline.java)
        at com.sun.prism.d3d.D3DPipeline.lambda$static$0(D3DPipeline.java:58)
        at java.security.AccessController.doPrivileged(AccessController.java:87)
        at com.sun.prism.d3d.D3DPipeline.<clinit>(D3DPipeline.java:50)
        at java.lang.Class.ensureInitialized(DynamicHub.java:552)
        at java.lang.Class.forName(DynamicHub.java:1436)
        at java.lang.Class.forName(DynamicHub.java:1408)
        at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)        
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)        
        at java.lang.Thread.run(Thread.java:829)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
GraphicsPipeline.createPipeline failed for com.sun.prism.sw.SWPipeline
java.lang.ClassNotFoundException: com.sun.prism.sw.SWPipeline
        at java.lang.Class.forName(DynamicHub.java:1433)
        at java.lang.Class.forName(DynamicHub.java:1408)
        at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)        
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)        
        at java.lang.Thread.run(Thread.java:829)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
Graphics Device initialization failed for :  d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
eline found
        at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
        at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:254)
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:264)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
        at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:679)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)       
        at java.lang.Thread.run(Thread.java:829)                                                                   at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)

D:\code\java\jfx-simple\shade>

-H:IncludeResourceBundles=com/sun/javafx/scene/control/skin/resources/controls,com/sun/javafx/scene/control/skin/resources/controls-nt,com.sun.javafx.tk.quantum.QuantumMessagesBundle,com/sun/glass/ui/win/themes should be config for native-image.

D:\code\java\jfx-simple\shade>jfx -Dprism.verbose=true
Dec 03, 2021 10:12:55 AM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @460b6d54'
Prism pipeline init order: d3d sw 
Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.d3d.D3DPipeline
Loading D3D native library ...
        succeeded.
D3DPipelineManager: Created D3D9Ex device
Direct3D initialization succeeded
(X) Got class = class com.sun.prism.d3d.D3DPipeline
Initialized prism pipeline: com.sun.prism.d3d.D3DPipeline
Maximum supported texture size: 8192
Maximum texture size clamped to 4096
OS Information:
        Windows version 0.0 build 0
D3D Driver Information:
        null
        null
        Driver null, version 0.0.0.0
        Pixel Shader version 0.0
        Device : ven_0000, dev_0000, subsys_00000000
        Max Multisamples supported: 0
 vsync: true vpipe: true
Dec 03, 2021 10:12:55 AM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
WARNING: Resource "com/sun/javafx/scene/control/skin/modena/modena.css" not found.
java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Method.java:566)
        at com.sun.prism.d3d.D3DResourceFactory.createStockShader(D3DResourceFactory.java:429)
        at com.sun.prism.impl.ps.BaseShaderContext.getPaintShader(BaseShaderContext.java:269)
        at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:500)
        at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:430)
        at com.sun.prism.impl.ps.BaseShaderGraphics.drawString(BaseShaderGraphics.java:2090)
        at com.sun.javafx.sg.prism.NGText.renderText(NGText.java:312)
        at com.sun.javafx.sg.prism.NGText.renderContent2D(NGText.java:270)
        at com.sun.javafx.sg.prism.NGShape.renderContent(NGShape.java:261)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
        at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270)
        at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:579)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
        at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270)
        at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:579)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
        at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:480)
        at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:329)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:92)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126)
        at java.lang.Thread.run(Thread.java:829)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
Caused by: java.lang.RuntimeException: InputStream must be non-null
        at com.sun.prism.d3d.D3DResourceFactory.getBuffer(D3DResourceFactory.java:365)
        at com.sun.prism.d3d.D3DResourceFactory.createShader(D3DResourceFactory.java:409)
        at com.sun.prism.shader.Texture_Color_Loader.loadShader(Texture_Color_Loader.java:49)
        ... 31 more
java.lang.InternalError: Error loading stock shader Texture_Color
        at com.sun.prism.d3d.D3DResourceFactory.createStockShader(D3DResourceFactory.java:432)
        at com.sun.prism.impl.ps.BaseShaderContext.getPaintShader(BaseShaderContext.java:269)
        at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:500)
        at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:430)
        at com.sun.prism.impl.ps.BaseShaderGraphics.drawString(BaseShaderGraphics.java:2090)
        at com.sun.javafx.sg.prism.NGText.renderText(NGText.java:312)
        at com.sun.javafx.sg.prism.NGText.renderContent2D(NGText.java:270)
        at com.sun.javafx.sg.prism.NGShape.renderContent(NGShape.java:261)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
        at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270)
        at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:579)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
        at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270)
        at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:579)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
        at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:480)
        at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:329)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:92)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126)
        at java.lang.Thread.run(Thread.java:829)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
QuantumRenderer: shutdown
 vsync: true vpipe: true
QuantumRenderer: shutdown

D:\code\java\jfx-simple\shade>

Then the last workable configuration is native-image -jar ../${{env.APP_NAME}}.jar --no-fallback -H:Name=${{env.APP_NAME}} -H:ReflectionConfigurationFiles=../resources/reflectconfig -H:JNIConfigurationFiles=../resources/jniconfig.json -H:ResourceConfigurationFiles=../resources/resourceconfig.json --allow-incomplete-classpath --verbose -H:IncludeResourceBundles=com/sun/javafx/scene/control/skin/resources/controls,com/sun/javafx/scene/control/skin/resources/controls-nt,com.sun.javafx.tk.quantum.QuantumMessagesBundle,com/sun/glass/ui/win/themes, see more details on liudonghua123/jfx-native-image@ae89900.

@Khithar
Copy link

Khithar commented Jan 9, 2022

"simplest" Solution is GluonFX ... it handles resources, FXML, css and so on.
https://docs.gluonhq.com/#_gluonfx_plugin_for_maven

I am using the latest 2022.1-dev and am quite happy with it, running quite complex FXML based FX Apps, but it was a lot of pain to find out all the configuration stuff. Some hints here ...

<nativeImageArgs\>
         <arg>-Djava.awt.headless=true</arg>
         <arg>--allow-incomplete-classpath</arg>
         <arg>--no-fallback</arg>
         <arg>-H: ReportUnsupportedElementsAtRuntime</arg>
 </nativeImageArgs> 

1.) test your application, if it runs fine with mvn gluonfx:run go to step 2 :)

2.) native-image-agent must be used to create config files for resources (FXML and css for example), reflection and so on:

  • define (if you use them) resourcebundles within bundlesList and resourcesList
  • mvn gluonfx:runagent
  • Click through your whole application, so agent "learns" needed methods, reflection and so on (rerun on changes, they will be migrated into config)
  • see results in META-INF/native.image

3.) mvn gluonfx:build creates your native image. Since gluonfx:package is not supported Windows yet, use InnoSetup to create an installer

4.) the evil part is finding out which dll's are needed in the directory where your start your .exe since package does not do this (yet). Maybe not all of them needed, depending on your Application.
Find dependencies of .dll's with for example:
dumpbin /dependents fontmanager.dll

awt.dll
fontmanager.dll
freetype.dll
java.dll
javaaccessbridge.dll
javajpeg.dll
jawt.dll
jsound.dll
jvm.dll
lcms.dll
sunmscapi.dll
vcruntime140.dll
verify.dll

5.) test your native image with mvn gluonfx:nativerun to get console output/errors

  • hint 1: see 4.
  • hint 2: initialize-at-build-time

@liudonghua123
Copy link

Use GluonFX is the "simplest" and clean Solution, however, I compared the size of produced binary. GluonFX build one has about 10M bigger size.

@melix
Copy link
Member

melix commented Apr 15, 2023

For those of you who are facing this problem, I managed to have an application working with JavaFX 17 (OpenJFX) and without the Gluon framework and custom JDK, simply using the official GraalVM build tools.

The trick:

graalvmNative {
    binaries.all {
        resources {
            autodetection {
                enabled.set(true)
                restrictToProjectDependencies.set(false)
            }
        }
    }
}

The project I tried if you are interested: https://github.com/melix/astro4j

@palexdev
Copy link

palexdev commented Jun 6, 2023

Any news on this? I don't want to rely on Gluon either
I have linker issues: Pastebin

@petermz
Copy link
Contributor

petermz commented Jun 7, 2023

@palexdev Your linker command line is missing FX libraries completely -- are there any in the lib/ dir? You might want to try NIK "full" edition to compile FX apps

@palexdev
Copy link

palexdev commented Jun 7, 2023

@palexdev Your linker command line is missing FX libraries completely -- are there any in the lib/ dir? You might want to try NIK "full" edition to compile FX apps

I couldn't find any info on how to add the .so libraries
I can't use NIK as their version of JavaFX is too old for my needs
Thing is, since JavaFX is added to the project through Gradle, shouldn't the libraries already be detected?

@petermz
Copy link
Contributor

petermz commented Jun 7, 2023

I thought you were using NIK based on the file paths in your log. Anyway, linker flags can be added using -H:NativeLinkerOption such as -H:NativeLinkerOption='-lglass -lprism_es2 ...

@palexdev
Copy link

palexdev commented Jun 7, 2023

I thought you were using NIK based on the file paths in your log. Anyway, linker flags can be added using -H:NativeLinkerOption such as -H:NativeLinkerOption='-lglass -lprism_es2 ...

I am. I'm not using their 'full' variant because of the reason above

Thanks, can these options be put in a json file too?
I'll try this and report back 👍🏻

@palexdev
Copy link

palexdev commented Jun 7, 2023

@petermz Pastebin
Looking much better, although there is still something missing. Are those errors related to this, perhaps? GluonFeature

@damnms
Copy link

damnms commented Jun 27, 2023

also trying to create a javafx native-image with gradle. unfortunately, the mentioned configuration from @melix example seem not to work/compatible with my stack because i still get that "No toolkit found". I use the gluon jvm

graalvmNative {

       metadataRepository {
      enabled = true
        //uri("https://github.com/oracle/graalvm-reachability-metadata/archive/refs/heads/master.zip") TODO: is there some way to get the master version instead of 0.3.2?
    }

    binaries.all {
        resources {
            autodetection {
                enabled.set(true)
                restrictToProjectDependencies.set(false)
            }
        }
        jvmArgs("--enable-preview")
    }
}

gradle/intellij also marks the block with:
resources cannot be applied to Groovy.lang.Closure

@palexdev
Copy link

palexdev commented Jun 27, 2023

also trying to create a javafx native-image with gradle. unfortunately, the mentioned configuration from @melix example seem not to work/compatible with my stack because i still get that "No toolkit found". I use the gluon jvm

graalvmNative {

       metadataRepository {
      enabled = true
        //uri("https://github.com/oracle/graalvm-reachability-metadata/archive/refs/heads/master.zip") TODO: is there some way to get the master version instead of 0.3.2?
    }

    binaries.all {
        resources {
            autodetection {
                enabled.set(true)
                restrictToProjectDependencies.set(false)
            }
        }
        jvmArgs("--enable-preview")
    }
}

gradle/intellij also marks the block with:
resources cannot be applied to Groovy.lang.Closure

Ah yes, so, my app is finally out, I wanted to make an article on GraalVM but I'm too busy so, I'm going to post my findings and thoughts here, at least for now

Long story short: GraalVM is a huge scam

Detailed explanation:
I coded my app in one week, but it got released only three weeks later. Because I spent all these days trying to make GraalVM work. I even had to switch from Spring to Micronaut and finally to the Inverno Framework, the only one working with GraalVM without too much configuration and the only one compliant with the new Java Modules System.
So, after three whole weeks, a lot of trials and errors, a lot of configuration and documentation I finally was able to compile a native image that would work pretty well....but then the horror. Three whole weeks only to discover that the app was buggy on Linux (not rendering properly). Configuration issue? GraalVM bug? Drivers issue? I don't know and honestly I don't want to know. At this point, I'm done with GraalVM. After this awful experience I can confidently affirm that this thing is useless and will work only for 'toy projects', like HelloWorld for example.

  • No JNA support, I had to change my dependencies too!
  • That crappy Gluon plugin has a broken agent, so every single configuration (reflection, resources, etc...) must be done manually. Good luck with that. And the worst part is that Gluon people don't even respond anymore on GitHub Issues
  • Logging frameworks are mostly broken. Good luck configuring a logging framework for GraalVM. I had to switch to Logback because it's the easiest to configure for Graal, and still good luck finding the correct configurations
  • Takes a lot to compile, which is not really a problem if you do it occasionally. But if you have errors at runtime and you enter the 'trial and error' loop, you're gonna see the compilation process A LOT, which is a loss of time, and as the saying goes: "time is money"

From now on I'm not gonna consider GraalVM an option for deployment anymore. Good on paper, crappy execution in reality.
Do yourselves a favor and don't use this, just use JLink or JPackage. If this is the time required to build an half functioning native image, then no thanks, the performance improvement is NOT worth it

As for your issue @damnms, I believe you can solve it by switching to SW rendering, check here to see how to set it up: ENBManager

@damnms
Copy link

damnms commented Jun 27, 2023

thanks for sharing your experience, i also encounter tons of problems. logging, jaxb stuff, javafx, ... guess i will also switch to jlink/jpackage.

@thomaswue
Copy link
Member

@palexdev Let me address some of your comments:

  1. The GraalVM distribution ships with a jlink/jpackage utility and you can certainly use that in case you cannot yet create a native image out of your JavaFX application.

  2. The configuration for logging frameworks is typically done by the relevant server-side framework like Micronaut, Quarkus, or Spring. Many different logging options work there out of the box and this area of server-side cloud applications is the main use case for GraalVM Native Image.

  3. While we know that GraalVM Native Image works also for many JavaFX applications, the GraalVM team currently makes no general claim to be usable out-of-the-box for such applications. We just released AWT support for desktop applications and JavaFX support will take longer down the road. You can see this also by this issue being still open.

In general, if you are running into issues for your use case, it would be appreciated if you provide the relevant inputs to improve the open source project such that we can fix potential issues. This would be certainly more constructive than attacking the maintainers. Remember that GraalVM is a very large project and even if it does not fit your specific use case, others might find it very useful for what they are doing themselves.

@UtilFunction
Copy link

UtilFunction commented Sep 21, 2023

I'm quite certain that this is actually an issue with Gradle, or more precisely the Gradle javafx plugin. Generating configs with the tracing agent and then compiling a JavaFX application to native works flawlessly with Maven and even sbt(Scala) but not with Gradle. I'm getting the very same error.

Posted an issue here.

@natsufumij
Copy link

I wrote a project that worked through JavaFX's media module, Native Image, and was working with the media module. If you are interested, you can come to my Repository:
https://github.com/natsufumij/javafx-native-media-demo

@damnms
Copy link

damnms commented Sep 23, 2023

@natsufumij your project uses maven, not gradle, and therefore has nothing to do with the problem reported by utilfunction

@SaptarshiSarkar12
Copy link

SaptarshiSarkar12 commented Jun 13, 2024

Is JavaFX now supported by Graalvm? I tried out some ways to build static JavaFX app binary in this repo but still failed with the exact same error.

Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found

If anyone of you have found a solution to this error without using gluonfx (because it does not build static executable), please let me know.

@SaptarshiSarkar12
Copy link

Please reply if anyone knows how to fix this error.

@jskov
Copy link

jskov commented Jun 18, 2024

I think it may because you do not have the correct dependencies available on your OS.

Try installing the dependencies listed here to see if that is the case: https://github.com/gluonhq/substrate

@petermz
Copy link
Contributor

petermz commented Jun 18, 2024 via email

@SaptarshiSarkar12
Copy link

I think it may because you do not have the correct dependencies available on your OS.

Try installing the dependencies listed here to see if that is the case: https://github.com/gluonhq/substrate

@jskov I already have those dependencies installed in my Ubuntu machine, still, the native-image fails to start the JavaFX Application showing the below error message 👇

Graphics Device initialization failed for :  sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
	at javafx.graphics@22-ea/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
	at javafx.graphics@22-ea/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:253)
	at javafx.graphics@22-ea/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:263)
	at javafx.graphics@22-ea/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290)
	at javafx.graphics@22-ea/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
	at javafx.graphics@22-ea/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
	at javafx.graphics@22-ea/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
	at javafx.graphics@22-ea/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
	at java.[email protected]/java.lang.Thread.runWith(Thread.java:1583)
	at java.[email protected]/java.lang.Thread.run(Thread.java:1570)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:853)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:829)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
	at javafx.graphics@22-ea/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)
	at javafx.graphics@22-ea/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
	... 4 more
Exception in thread "main" java.lang.RuntimeException: No toolkit found
	at javafx.graphics@22-ea/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:275)
	at javafx.graphics@22-ea/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290)
	at javafx.graphics@22-ea/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
	at javafx.graphics@22-ea/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
	at javafx.graphics@22-ea/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
	at javafx.graphics@22-ea/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
	at java.[email protected]/java.lang.Thread.runWith(Thread.java:1583)
	at java.[email protected]/java.lang.Thread.run(Thread.java:1570)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:853)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:829)

@SaptarshiSarkar12
Copy link

Another possibility is that something is missing from your reflection config. QuantumToolkit is sure to rely on reflection heavily

@petermz I already had that present in my reflect-config.json file. Still, the native-image failed to start the JavaFX application.
image

@SaptarshiSarkar12
Copy link

Any other ideas? 🤔

@Lemon-King
Copy link

Lemon-King commented Jun 19, 2024

Is JavaFX now supported by Graalvm? I tried out some ways to build static JavaFX app binary in this repo but still failed with the exact same error.

Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found

If anyone of you have found a solution to this error without using gluonfx (because it does not build static executable), please let me know.

I bashed my head against this error (and others) for a few weeks with my JavaFX application.
What I figured out was that your compiled application folder needs to include the following core dlls from GRAALVM_HOME:

  • /bin/awt.dll
  • /bin/java.dll
  • /bin/server/jvm.dll
  • /bin/windowsaccessbridge-64.dll

I export those files into the same path as the exe.

If you're still receiving errors after that, ensure you have your reflection properly configured. Launch the application with gluonfx:runagent (within x64 Native Tools Command Prompt from Visual Studio) and access everything to map out a full reflection. Now build, your app should run just fine.

@SaptarshiSarkar12
Copy link

@Lemon-King Sorry for the late reply 😞. I was busy last week. I am using Ubuntu so, I placed my executable in the same folder where .so files were placed. But, the app still failed with the same error. Moreover, I wasn't using Gluonfx maven plugin because it does not build static executables which I needed. So, I preferred to use only GraalVM but got stuck in that error.
Do you know how to fix that one using only GraalVM? Please let me know 😀.

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