문제

I'm developing a maven-built JavaFX 2 application in eclipse.

Everything is running fine on Windows, but Mac OSX is causing problems. I have to include the following line to prevent the application from starting in Headless mode:

System.setProperty("java.awt.headless", "false");

However, disabling headless mode like that is giving me this error on Mac:

java[15689:707] Cocoa AWT: Apple AWT Java VM was loaded on first thread -- can't start AWT. (

0 liblwawt.dylib
0x000000016674fba2 JNI_OnLoad + 468 1 libjava.dylib
0x00000001037286d1 Java_java_lang_ClassLoader_00024NativeLibrary_load + 207 2 ??? 0x00000001037fef90 0x0 + 4353683344 ) Exception in Application start method

There are no problems running in headless mode but I need the Robot class to handle keyPress events. I don't even know why it's trying to run headless while I don't need it.

도움이 되었습니까?

해결책

Due to AWT requirement for being run on main thread of AWT application it's not compatible with JavaFX. You may find ways to workaround that here: JavaFX screencapture headless exception on OSX

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top