Java SWT JD WebBrowser JFrame在Windows上运行,但不在Mac

时间:2016-11-22 21:51:17

标签: java macos swing swt jwebbrowser

我正在开发使用JD Native Swing WebBrowser控件的Java应用程序,而应用程序在Windows上运行正常,但它无法在Mac上正常运行。 据我所知,要运行SWT控件,我必须引用swt.jar的Mac版本(完成),我也尝试了-XstartOnFirstThread参数,但是在使用时,整个应用程序都没有启动。

应用程序由使用Swing JFrame制作的登录屏幕组成。 然后,当登录成功时,将释放JFrame登录。 应显示SWT WebBrowser控件,但抛出异常。

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

你有任何解决方案吗? 我很确定运行-XstartOnFirstThread可以解决它,但不会运行。

:-)感谢您的帮助。

0 个答案:

没有答案