Jme-jfx-11 on MacOs Issue on JavaFxUI initialize

Hello everybody,

Recently I have tried to use Java FX with jme-jfx-11 from jayfella
on a project which I am developing from a mac book. (OS Version 10.13.6)

My application does crash, when following line is called

JavaFxUI.initialize(this);

I just tried the example from JMonkeyStore jme-jfx-11 from jayfella.
(With same build.gradle dependencies from the descriptions with version 1.1.5)
While this is running all totally fine on my windows, on my macbook
I get this error on the console:

2020-03-20 21:22:08.928 java[774:42513] *** Assertion failure in -[NSMenu itemAtIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.61.100/Menus.subproj/NSMenu.m:967
2020-03-20 21:22:08.930 java[774:42513] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: index >= 0'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff285600db __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fff4f89c942 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff28565cc2 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x00007fff2a6aea30 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
	4   AppKit                              0x00007fff25a5a06c -[NSMenu itemAtIndex:] + 216
	5   AppKit                              0x00007fff25a3db19 -[NSApplication(NSWindowsMenu) setWindowsMenu:] + 199
	6   libglass.dylib                      0x0000000132dd97a7 -[GlassApplication runLoop:] + 1831
	7   libglass.dylib                      0x0000000132dda1e8 Java_com_sun_glass_ui_mac_MacApplication__1runLoop + 264
	8   ???                                 0x00000001184188d0 0x0 + 4701915344
	9   ???                                 0x0000000118412ca7 0x0 + 4701891751
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Has anybody an idea, why this occurs? Anybody ever tried this with a mac?

Note:
I am using eclipse for developing.
In use: jdk-11.0.5
VM arguments: -XstartOnFirstThread.
Also use “setShowSettings(false);” (Because settings window seems to have issues on mac)

Yea, it doesn’t work at all on OSX. From what i’ve been able to tell… it is expecting some sort of menu access that it doesn’t have and so it crashes. I haven’t found a way around it yet.

2 Likes

Okay, thanks for the answer.
With Java 8 this was still working. (With the older lib)
@jayfella do you know by chance any workaround to get this running on OSX?

I don’t “know” of a work around, but maybe upping the jfx plugin version and the jfx version to 12 or 13 might solve it. It’s worth a try.

I just ran into this one. Have you had a chance to look at this?

2020-08-02 17:36:23.542 java[1178:11742] *** Assertion failure in -[NSMenu itemAtIndex:], /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1894.60.100/Menus.subproj/NSMenu.m:981
2020-08-02 17:36:23.545 java[1178:11742] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: index >= 0'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff375aab57 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff702585bf objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff375d3d08 +[NSException raise:format:arguments:] + 88
	3   Foundation                          0x00007fff39cc5e9d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
	4   AppKit                              0x00007fff3478ec2c -[NSMenu itemAtIndex:] + 198
	5   AppKit                              0x00007fff3478e4ed -[NSApplication(NSWindowsMenu) setWindowsMenu:] + 189
	6   libglass.dylib                      0x0000000135ea57a7 -[GlassApplication runLoop:] + 1831
	7   libglass.dylib                      0x0000000135ea61e8 Java_com_sun_glass_ui_mac_MacApplication__1runLoop + 264
	8   ???                                 0x0000000113beb330 0x0 + 4626232112
	9   ???                                 0x0000000113be5be7 0x0 + 4626209767
)
libc++abi.dylib: terminating with uncaught exception of type NSException
zsh: abort      ../jvm/Contents/Home/bin/java -XstartOnFirstThread -jar OutsideClient.jar

EDIT: @jayfella by going to jfx 12, I get this error from jme-jfx-11 on windows (did not test on osx):

Exception in thread "JavaFX Application Thread" java.lang.NoSuchMethodError: com.sun.javafx.embed.EmbeddedSceneInterface.mouseEvent(IIZZZIIIIZZZZZ)V
	at com.jayfella.jme.jfx.injme.input.JmeFXInputListener.onMouseMotionEventImpl(JmeFXInputListener.java:453)
	at com.jayfella.jme.jfx.injme.input.JmeFXInputListener.lambda$onMouseMotionEvent$2(JmeFXInputListener.java:405)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
	at java.base/java.lang.Thread.run(Thread.java:834)

EDIT 2: It does look like there was a very similar error fixed in jfx12: https://bugs.openjdk.java.net/browse/JDK-8211304
But it looks that the patch was included in 11.0.2 of jfx as well.

There’s some remarked code for Java 12 - as far as I remember there’s only 2 changes needed.

1 Like