我在Mac OS X Yosemite上使用JDK 8。
当我调用new JFXPanel();
(初始化JavaFX)时,应用程序崩溃了这个堆栈跟踪:
Prism pipeline init order: sw
Using native-based Pisces 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
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
(X) Got class = class com.sun.prism.sw.SWPipeline
Initialized prism pipeline: com.sun.prism.sw.SWPipeline
Dec 1 09:27:04 Mac-mini.local java[824] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Dec 1 09:27:04 Mac-mini.local java[824] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Dec 1 09:27:04 Mac-mini.local java[824] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Dec 1 09:27:04 Mac-mini.local java[824] <Warning>: Invalid Connection ID 0
RenderJob.run: internal exception
java.lang.ArrayIndexOutOfBoundsException: 0
at java.util.Arrays$ArrayList.get(Arrays.java:3841)
at java.util.Collections$UnmodifiableList.get(Collections.java:1309)
at com.sun.glass.ui.Screen.getMainScreen(Screen.java:61)
at com.sun.prism.sw.SWPipeline.getDefaultResourceFactory(SWPipeline.java:82)
at com.sun.prism.GraphicsPipeline.getDefaultResourceFactory(GraphicsPipeline.java:120)
at com.sun.javafx.tk.quantum.QuantumRenderer.lambda$createResourceFactory$414(QuantumRenderer.java:161)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.lang.Thread.run(Thread.java:745)
我正在使用-Dprism.order=sw
。我现在能做什么?谢谢。
在Windows中,相同的代码可以正常工作。
我正在使用Spring,然后用:
初始化JavaFX @PostConstruct
public void postConstruct() {
new JFXPanel();
}
有应用程序崩溃。