Java SWT JD WebBrowser JFrame fonctionne sous Windows, mais pas sur Mac


Je développe une application Java qui utilise le contrôle JD Native Swing WebBrowser, alors que l'application fonctionne correctement sous Windows, elle ne fonctionne pas correctement sur Mac. Comme je le sais, pour exécuter les contrôles SWT, je dois référencer la version Mac de swt.jar (terminé), j'ai également essayé l'argument-XstartOnFirstThread, mais lorsqu'il est utilisé, toute l'application ne démarre pas.

L'application est composée d'un écran de connexion réalisé à l'aide de Swing JFrame. Ensuite, lorsque la connexion est réussie, la connexion JFrame est éliminé. Le contrôle SWT WebBrowser devrait apparaître, mais à la place une exception est levée.

On Mac, "NativeInterface.initialize()"/"NativeInterface.open()" should
not be called after AWT static initializers have run, otherwise there
can be all sorts of side effects (non-functional modal dialogs, etc.).
Generally, the problem is when the "main(String[])" method is located
inside an AWT component subclass and the fix is to move that main
method to a standalone class. The problematic class here is
"scribo_formac.MainPage"
***WARNING: Display must be created on main thread due to Cocoa restrictions. 2016-11-22 13:41:54.037 java[797:f07] _createMenuRef
called with existing principal MenuRef already associated with menu
2016-11-22 13:41:54.038 java[797:f07] ( 0   CoreFoundation            
0x00007fff8ac9e0a6 __exceptionPreprocess + 198 1   libobjc.A.dylib    
0x00007fff918613f0 objc_exception_throw + 43 2   CoreFoundation       
0x00007fff8ac9de7c +[NSException raise:format:] + 204 3   AppKit      
0x00007fff8d937eac -[NSCarbonMenuImpl _createMenuRef] + 62 4   AppKit 
0x00007fff8d9377fb -[NSCarbonMenuImpl _instantiateCarbonMenu] + 143 5 
AppKit                              0x00007fff8d936743 -[NSApplication
finishLaunching] + 778 6   libosxapp.dylib                    
0x00000001a9b61e5a -[NSApplicationAWT finishLaunching] + 683 7  
libswt-pi-cocoa-4626.jnilib         0x00000001dbf746e9
Java_org_eclipse_swt_internal_cocoa_OS_objc_1msgSendSuper__Lorg_eclipse_swt_internal_cocoa_objc_1super_2J + 153 8   ???                                 0x000000010b6c83b4 0x0 + 4486628276 )
_NSJVMLoadLibrary: NSAddLibrary failed for /libjawt.dylib JavaVM FATAL: lookup of function JAWT_GetAWT failed. Exit

Avez-vous une solution pour cela? Je suis à peu près sûr que running-XstartOnFirstThread pourrait le résoudre, mais ne s'exécute pas.

:-) Merci pour votre aide.

Author: Joe C, 2016-11-23