Question

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.

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top